#include <bits/stdc++.h>
using namespace std;
int i, n, m, a[105], j;
string s[105], ans = "";
vector<string> v, v1;
map<int, int> mark;
int main() {
  cin >> n >> m;
  for (i = 1; i <= n; i++) {
    cin >> s[i];
  }
  cin >> a[0];
  mark[a[0]] = 1;
  int l = s[a[0]].size();
  v.push_back(s[a[0]]);
  for (i = 1; i < m; i++) {
    cin >> a[i];
    mark[a[i]] = 1;
    if (l != s[a[i]].size()) {
      cout << "No";
      return 0;
    }
    v.push_back(s[a[i]]);
    l = s[a[i]].size();
  }
  int k = 0;
  for (i = 0; i < l; i++) {
    char c = v[0][i];
    for (j = 0; j < v.size(); j++) {
      if (v[j][i] != c) {
        ans += '?';
        break;
      }
      if (j == v.size() - 1) {
        ans += v[j][i];
      }
    }
  }
  for (i = 1; i <= n; i++) {
    if (mark[i] == 0) {
      v1.push_back(s[i]);
    }
  }
  int tmp = 0, tmp1 = 0;
  for (i = 0; i < v1.size(); i++) {
    if (v1[i].size() != l) {
      continue;
    }
    for (j = 0; j < v1[i].size(); j++) {
      if (ans[j] == '?') {
        tmp1++;
      }
      if (ans[j] == v1[i][j]) {
        tmp++;
      }
    }
    if (tmp + tmp1 == l) {
      cout << "No";
      return 0;
    }
    tmp = 0;
    tmp1 = 0;
  }
  cout << "Yes" << endl << ans;
}
