#ifdef NACHIA #define _GLIBCXX_DEBUG #else // disable assert #define NDEBUG #endif #include #include #include #include #include using namespace std; using ll = long long; const ll INF = 1ll << 60; #define REP(i,n) for(ll i=0; i using V = vector; template void chmax(A& l, const B& r){ if(l < r) l = r; } template void chmin(A& l, const B& r){ if(r < l) l = r; } struct Node { ll lower = 0; ll upper = 0; ll just = 0; map nx; }; void testcase(){ ll N, M; cin >> N >> M; M = N - M; V S(N); REP(i,N) cin >> S[i]; V trie(1); for(auto& s : S){ ll p = 0; for(char c : s){ if(!trie[p].nx.count(c)){ trie[p].nx[c] = trie.size(); trie.push_back(Node()); } p = trie[p].nx[c]; } trie[p].lower += 1; trie[p].upper += 1; trie[p].just += 1; } ll Z = trie.size(); REP(i,Z) for(auto [u,v] : trie[i].nx) trie[v].upper += trie[i].upper; for(ll i=Z-1; i>=0; i--) for(auto [u,v] : trie[i].nx) trie[i].lower += trie[v].lower; string ans; auto dfs = [&](auto& dfs, ll p) -> bool { if(p != 0 && trie[p].lower + trie[p].upper - trie[p].just <= M) return 1; if(trie[p].upper > M) return 0; for(ll k='a'; k<='z'; k++){ if(trie[p].nx.count(k)){ if(dfs(dfs, trie[p].nx[k])){ ans.push_back(k); return 1; } } else { ans.push_back(k); return 1; } } return 0; }; if(dfs(dfs, 0)){ reverse(ans.begin(), ans.end()); cout << "Yes\n"; cout << ans << "\n"; } else { cout << "No\n"; } } int main(){ cin.tie(0)->sync_with_stdio(0); testcase(); return 0; }