#include <bits/stdc++.h>
int n, m, cnt, len, id;
char a[101][101], res[101][101], re[101];
bool flag, vis[101];
int main() {
  while (scanf("%d%d", &n, &m) == 2) {
    memset(vis, 0, sizeof vis);
    for (int i = 0; i < n; ++i) scanf("%s", a[i]);
    cnt = 0;
    for (int i = 0; i < m; ++i) {
      scanf("%d", &id);
      --id;
      vis[id] = true;
      memcpy(res[cnt], a[id], sizeof a[0]);
      ++cnt;
    }
    flag = false;
    len = strlen(res[0]);
    for (int i = 1; i < cnt; ++i)
      if (len != (int)strlen(res[i])) flag = true;
    if (flag) {
      puts("No");
      continue;
    }
    for (int i = 0; i < len; ++i) {
      flag = false;
      for (int j = 0; j < cnt - 1; ++j)
        if (res[j][i] != res[j + 1][i]) flag = true;
      if (!flag)
        re[i] = res[0][i];
      else
        re[i] = '?';
    }
    for (int i = 0; i < n; ++i) {
      flag = false;
      if (vis[i] == true) {
        flag = true;
        continue;
      }
      int l = strlen(a[i]);
      if (l != len) {
        flag = true;
        continue;
      }
      for (int j = 0; j < l; ++j) {
        if (re[j] == '?') continue;
        if (re[j] != a[i][j]) {
          flag = true;
          break;
        }
      }
      if (!flag) {
        break;
      }
    }
    if (!flag)
      puts("No");
    else {
      puts("Yes");
      puts(re);
    }
  }
  return 0;
}
