#include <bits/stdc++.h>
using namespace std;
const int MAX_NM = 100 + 5;
int N, M, ID[MAX_NM];
string Ans, Name[MAX_NM];
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cin >> N >> M;
  for (int i = 1; i <= N; ++i) cin >> Name[i];
  for (int i = 1; i <= M; ++i) cin >> ID[i];
  for (int i = 2; i <= M; ++i)
    if (Name[ID[1]].size() != Name[ID[i]].size()) return cout << "No", 0;
  for (int i = 0; i < Name[ID[1]].size(); ++i) {
    int j;
    for (j = 2; j <= M; ++j)
      if (Name[ID[1]][i] != Name[ID[j]][i]) {
        Ans += '?';
        break;
      }
    if (j == M + 1) Ans += Name[ID[1]][i];
  }
  for (int i = 1; i <= N; ++i)
    if (!binary_search(ID + 1, ID + M + 1, i) && Name[i].size() == Ans.size()) {
      int j;
      for (j = 0; j < Ans.size(); ++j) {
        if (Ans[j] == '?') continue;
        if (Ans[j] != Name[i][j]) break;
      }
      if (j == Ans.size()) return cout << "No", 0;
    }
  cout << "Yes" << endl << Ans;
  return 0;
}
