#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, a[1001];
  string s[1001];
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> s[i];
  }
  int sz = 0;
  map<int, int> mp;
  vector<int> v;
  for (int i = 1; i <= m; i++) {
    cin >> a[i];
    mp[a[i]] = 1;
    sz = max(sz, (int)s[a[i]].size());
  }
  for (int i = 1; i <= n; i++) {
    if (mp[i]) {
    } else
      v.push_back(i);
  }
  string Ans = "";
  int f, fl = 1, flag = 0;
  char ch;
  for (int i = 0; i < sz; i++) {
    f = 0;
    for (int j = 1; j <= m; j++) {
      if ((int)s[a[j]].size() <= i) {
        flag = 2;
        break;
      }
      if (j == 1)
        ch = s[a[j]][i];
      else if (ch != s[a[j]][i]) {
        f = 1;
        break;
      }
    }
    if (flag == 2)
      break;
    else if (f) {
      Ans += "?";
    } else {
      Ans += ch;
    }
  }
  for (int i = 0; i < (int)v.size(); i++) {
    string sg = s[v[i]];
    if ((int)sg.size() == sz) {
      f = 0;
      for (int j = 0; j < sz; j++) {
        if (sg[j] != Ans[j]) {
          if (Ans[j] == '?') {
          } else
            f = 1;
        }
      }
      if (!f) fl = 0;
    }
  }
  if (flag == 2)
    cout << "No" << endl;
  else if (fl) {
    cout << "Yes" << endl;
    cout << Ans << endl;
  } else
    cout << "No" << endl;
  return 0;
}
