#include <bits/stdc++.h>
using namespace std;
char s[105][105], ans[105];
int len[105], n, m;
int Q[105];
bool failed = false, vis[105];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; ++i) {
    cin >> s[i];
    len[i] = strlen(s[i]);
  }
  int mmm = 0;
  for (int i = 1; i <= m; ++i) {
    scanf("%d", &Q[i]);
    if (mmm == 0)
      mmm = len[Q[i]];
    else if (mmm != len[Q[i]])
      failed = true;
    vis[Q[i]] = true;
  }
  if (failed) {
    printf("No\n");
    return 0;
  }
  bool ok;
  for (int i = 0; i < mmm; ++i) {
    ok = true;
    for (int j = 2; j <= m; ++j)
      if (s[Q[j]][i] != s[Q[j - 1]][i]) {
        ok = false;
        break;
      }
    if (ok)
      ans[i] = s[Q[1]][i];
    else
      ans[i] = '?';
  }
  for (int i = 1; i <= n; ++i) {
    if (vis[i]) continue;
    ok = true;
    if (len[i] != mmm) continue;
    for (int j = 0; j < mmm; ++j)
      if (s[i][j] != ans[j] && ans[j] != '?') {
        ok = false;
        break;
      }
    if (ok) {
      printf("No\n");
      return 0;
    }
  }
  printf("Yes\n");
  ans[mmm] = '\0';
  puts(ans);
}
