#include <bits/stdc++.h>
using namespace std;
long long a[503400], b[477574], c[534567], d, e, i, j, r, m, y, k, l, n, s, z,
    x, t, tt;
string p[3456], q, qq;
map<long long, long long> zz;
int main() {
  cin >> n >> m;
  for (i = 1; i <= n; i++) cin >> p[i];
  cin >> x;
  q = p[x];
  a[x] = 1;
  t = q.size();
  for (i = 1; i < m; i++) {
    cin >> y;
    a[y] = 1;
    if (p[y].size() != t) {
      cout << "No";
      return 0;
    }
    for (j = 0; j < t; j++) {
      if (q[j] == '?') continue;
      if (p[y][j] != q[j]) q[j] = '?';
    }
  }
  for (i = 1; i <= n; i++) {
    if (a[i] == 1) continue;
    if (p[i].size() != t) continue;
    x = 0;
    for (j = 0; j < t; j++) {
      if (q[j] == '?') continue;
      if (q[j] != p[i][j]) x = 1;
    }
    if (x == 0) {
      cout << "No";
      return 0;
    }
  }
  cout << "Yes" << endl << q;
}
