#include <bits/stdc++.h>
using namespace std;
int s;
string ans;
string cit[110];
int main() {
  ios_base ::sync_with_stdio(0);
  int n, m;
  cin >> n >> m;
  for (int i(1); i <= n; i++) cin >> cit[i];
  while (m--) {
    int x;
    cin >> x;
    if (ans.empty()) {
      ans = cit[x];
      cit[x] = "";
    } else {
      if (ans.size() != cit[x].size()) {
        cout << "No\n";
        return 0;
      }
      for (int i(0); i < ans.size(); i++) {
        if (ans[i] != cit[x][i]) ans[i] = '?';
      }
      cit[x] = "";
    }
  }
  for (int i(1); i <= n; i++) {
    if (cit[i].size() != ans.size()) continue;
    bool mere(1);
    for (int j(0); j < ans.size(); j++) {
      if (ans[j] != cit[i][j] && ans[j] != '?') mere = 0;
    }
    if (mere) {
      cout << "No\n";
      return 0;
    }
  }
  cout << "Yes\n" << ans;
  return 0;
}
