#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<string> v(n);
  vector<bool> check(n, 0);
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
  }
  vector<int> q(n);
  int x;
  cin >> x;
  --x;
  check[x] = 1;
  int ref = v[x].size();
  string Ref = v[x];
  for (int i = 0; i < m - 1; ++i) {
    int x;
    cin >> x;
    --x;
    check[x] = 1;
    if (v[x].size() != ref) {
      cout << "No\n";
      return 0;
    }
    for (int j = 0; j < ref; ++j) {
      if (Ref[j] != v[x][j]) Ref[j] = '?';
    }
  }
  for (int i = 0; i < n; ++i) {
    if (check[i] == 0) {
      if (v[i].size() == ref) {
        bool del = 0;
        for (int j = 0; !del and j < ref; ++j) {
          if (Ref[j] != v[i][j] and Ref[j] != '?') del = 1;
        }
        if (!del) {
          cout << "No\n";
          return 0;
        }
      }
    }
  }
  cout << "Yes\n";
  cout << Ref << endl;
}
