#include <bits/stdc++.h>
using namespace std;
int ind, n, l, m;
string s[111];
set<int> ms;
set<string> ds;
set<string> als;
int main() {
  cin >> n >> m;
  for (auto i = 1; i <= n; i++) {
    cin >> s[i];
    als.insert(s[i]);
  }
  string pre = "";
  for (auto i = 0; i < m; i++) {
    cin >> ind;
    string xx = s[ind];
    als.erase(xx);
    ds.insert(xx);
    if (pre.size() == 0) {
      pre = xx;
      continue;
    }
    if (pre.size() != xx.size()) {
      return cout << "No", 0;
    }
    for (auto i = 0; i < pre.size(); i++) {
      if (pre[i] == '?') continue;
      if (pre[i] != xx[i])
        pre[i] = '?';
      else if (pre[i] == xx[i])
        continue;
    }
  }
  for (auto i = als.begin(); i != als.end(); i++) {
    string tmp = (*i);
    string chk = tmp;
    if (pre.size() != chk.size())
      continue;
    else {
      int mch(0);
      for (auto i = 0; i < pre.size(); i++) {
        if (pre[i] == '?') {
          mch++;
          continue;
        }
        if (pre[i] == chk[i]) {
          mch++;
          continue;
        } else if (pre[i] != chk[i]) {
          continue;
        }
      }
      if (mch == pre.size() and mch == chk.size()) {
        return cout << "No", 0;
      }
    }
  }
  cout << "Yes" << endl;
  cout << pre << endl;
  return 0;
}
