#include <bits/stdc++.h>
const int MOD = 1000000007;
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<string> v(n + 1);
  for (int i = 1; i <= n; i++) {
    string s;
    cin >> s;
    v[i] = s;
  }
  set<int> ans;
  int a[m];
  for (int i = 0; i < m; i++) {
    cin >> a[i];
    string str = v[a[i]];
    int zz = str.size();
    ans.insert(zz);
  }
  sort(a, a + m);
  if (ans.size() == 1) {
    string s;
    int x = *ans.begin();
    for (int i = 0; i < x; i++) {
      set<char> c;
      for (int j = 0; j < m; j++) {
        string x = v[a[j]];
        char cc = x[i];
        c.insert(cc);
      }
      if (c.size() == 1) {
        s.push_back(*c.begin());
      } else
        s.push_back('?');
    }
    bool chk = 0;
    for (int i = 1; i <= n; i++) {
      bool flag = 0;
      if (binary_search(a, a + m, i))
        continue;
      else {
        if (v[i].size() == x) {
          for (int j = 0; j < x; j++) {
            if (s[j] == '?')
              continue;
            else {
              if (s[j] == v[i][j])
                continue;
              else {
                flag = 1;
                break;
              }
            }
          }
          if (flag == 0) {
            chk = 1;
            break;
          }
        }
      }
    }
    if (chk == 1) {
      cout << "No\n";
    } else {
      cout << "Yes\n";
      cout << s << endl;
    }
  } else
    cout << "No\n";
}
