#include <bits/stdc++.h>
using namespace std;
int n, m, nn;
char s[103], t[103][103];
int a[103][103];
int dd[103], sd[103];
int l[103];
int dung[103];
int b[103];
int main() {
  cin >> n >> m;
  nn = 0;
  for (int i = 1; i <= n; ++i) {
    cin >> s;
    l[i] = strlen(s);
    for (int j = 1; j <= l[i]; ++j) a[i][j] = s[j - 1], t[i][j] = s[j - 1];
  }
  for (int i = 1; i <= n; ++i)
    for (int j = l[i] + 1; j <= nn; ++j) a[i][j] = -1;
  for (int i = 1; i <= m; ++i) cin >> dd[i];
  bool dt = true;
  nn = l[dd[1]];
  for (int i = 1; i <= m; ++i) {
    int u = dd[i];
    if (l[u] != nn) {
      dt = false;
      break;
    }
  }
  if (!dt)
    cout << "No";
  else {
    for (int i = 1; i <= nn; ++i) dung[i] = 1;
    int u = dd[1];
    for (int i = 1; i <= nn; ++i) b[i] = a[u][i];
    for (int i = 2; i <= m; ++i) {
      u = dd[i];
      for (int j = 1; j <= nn; ++j)
        if (a[u][j] != b[j]) dung[j] = 0;
    }
    for (int i = 1; i <= m; ++i) sd[dd[i]] = 1;
    int tm = 1;
    for (int i = 1; i <= n; ++i)
      if (sd[i] == 0 && l[i] == nn) {
        bool ok = false;
        for (int j = 1; j <= nn; ++j)
          if (dung[j] == 1 && a[i][j] != b[j]) ok = true;
        if (!ok) {
          tm = 0;
          break;
        }
      }
    if (tm == 0)
      cout << "No";
    else {
      cout << "Yes\n";
      for (int i = 1; i <= nn; ++i) {
        if (dung[i] == 0)
          cout << "?";
        else
          cout << t[dd[1]][i];
      }
    }
  }
}
