#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <map>
#include <set>
#include <functional>

using namespace std;

void solve(int test_ind){
	int n;
	cin >> n;
	int k;
	cin >> k;
	vector<string> v(n);
	for (int i=0;i<n;++i) cin >> v[i];
	vector<int> d(k, 1);
	for (int i=0;i<k;++i) {
		for (int j=0;j<n;++j) {
			if (v[j] == string(v[j].size(), i+'a')) {
				d[i] = 0;
				break;
			}
			for (int t=0;t<v[j].size();++t) {
				if (v[j][t] == (i + 'a')) d[i]++;
				else break;
			}
		}
	}
	int mn = n * 10;
	for (int i=0;i<k;++i) if (d[i] && d[i] < mn) mn = d[i];
	if (mn == n * 10) {
		cout << "NO" << endl;
	} else {
		for (int i=0;i<k;++i) {
			if (d[i] == mn) {
				cout << string(d[i], i + 'a') << endl;
				break;
			}
		}
	}
}

int main(){
	cin.tie(0);
	ios_base::sync_with_stdio(false);
	int t=1;
	//cin >> t;
	for(int i=0;i<t;i++){
		solve(i);
	}
	return 0;
}
