#include <bits/stdc++.h>
using namespace std;
const int maxn = 100 + 10;
char s[maxn][maxn];
int f[maxn];
char match[maxn];
int n, m, len;
int find(int x) {
  int ok = 1;
  for (int i = 1; i <= m; i++)
    if (f[i] == x) ok = 0;
  return ok;
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%s", s[i]);
  for (int i = 1; i <= m; i++) scanf("%d", &f[i]);
  len = strlen(s[f[1]]);
  for (int i = 2; i <= m; i++)
    if (len != strlen(s[f[i]])) {
      printf("No\n");
      return 0;
    }
  for (int i = 0; i < len; i++) {
    match[i] = s[f[1]][i];
    for (int j = 2; j <= m; j++) {
      if (s[f[j]][i] != match[i]) match[i] = '?';
    }
  }
  for (int i = 1; i <= n; i++) {
    if (len != strlen(s[i])) continue;
    if (find(i)) {
      int j;
      for (j = 0; j < len; j++) {
        if (match[j] == '?') continue;
        if (match[j] != s[i][j]) break;
      }
      if (j < len - 1) continue;
      if (s[i][j] == match[j] || match[j] == '?') {
        printf("No\n");
        return 0;
      }
    }
  }
  printf("Yes\n");
  for (int i = 0; i < len; i++) printf("%c", match[i]);
  printf("\n");
  return 0;
}
