#include <iostream>
#include<vector>
#include<algorithm>
using namespace std;

#define forn(i,n) for(int i=0; i<n; ++i)

const int N=26;
vector<int> adj[N];

void solve() {
    
    int n,c; cin>>n>>c;
    vector<string> a(n);
    forn(i,n) cin>>a[i];
    vector<int> ok(c);
    vector<int> bad(c);
    forn(i,n) {
        int z=1; for(auto&x:a[i]) z&=x==a[i][0];
        if (z) bad[a[i][0]-'a']=1;
        ok[a[i][0]-'a']=1;
    }
    int cnt=0; forn(i,c) cnt+=bad[i];
    if (cnt==c) {
        cout<<"NO\n"; return;
    }
    forn(i,c) {
        if (!ok[i]) {
            cout<<(char)('a'+i)<<'\n'; return;
        }
    }
    int ans=1e9;
    string z;
    forn(i,c) {
        if (bad[i]) continue;
        int cnt=0;
        forn(j,n) {
            int p=0;
            while (a[j][p]-'a' == i) {
                ++cnt;
                ++p;
            }
        }
        if (cnt+1 < ans) {
            z = string(cnt+1,char('a'+i));
            ans = cnt+1;
        }
    }
    cout<<z<<'\n';

}

int main() {
    int t=1; //cin>>t;
    while (t--) solve();
}
