#include <bits/stdc++.h>
using namespace std;
const int MAX = 110;
int n, m;
char s[MAX][MAX];
char ans[MAX];
int a[MAX];
int main() {
  int i, j, k, t;
  while (~scanf("%d%d", &n, &m)) {
    memset(ans, 0, sizeof(ans));
    memset(a, 0, sizeof(a));
    for (i = 1; i <= n; i++) scanf("%s", s[i]);
    for (i = 1; i <= m; i++) scanf("%d", &a[i]);
    k = 1;
    int flag = 0;
    int len = strlen(s[a[1]]);
    for (i = 1; i <= n; i++) {
      if (k <= m && a[k] == i) {
        k++;
        int lenn = strlen(s[i]);
        if (len != lenn) {
          flag = 1;
          break;
        }
      }
    }
    if (flag) {
      printf("No\n");
      continue;
    }
    for (j = 0; j < len; j++) {
      k = 1;
      for (i = 1; i <= n; i++) {
        if (k <= m && a[k] == i) {
          k++;
          if (s[i][j] != s[a[1]][j]) break;
        }
      }
      if (i != n + 1)
        ans[j] = '?';
      else
        ans[j] = s[a[1]][j];
    }
    ans[len] = '\0';
    k = 1;
    for (i = 1; i <= n; i++) {
      if (a[k] == i) {
        k++;
        continue;
      }
      int lenn = strlen(s[i]);
      if (lenn != len) continue;
      for (j = 0; j < len; j++) {
        if (s[i][j] != ans[j] && ans[j] != '?') break;
      }
      if (j == len) break;
    }
    if (i != n + 1) {
      printf("No\n");
    } else {
      printf("Yes\n");
      printf("%s", ans);
    }
  }
  return 0;
}
