#include <bits/stdc++.h>
int n, m, a[110], l;
char s[110][110], w[110];
bool Q = true, q, vis[110];
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%s", s[i] + 1);
  for (int i = 1; i <= m; i++) scanf("%d", &a[i]), vis[a[i]] = true;
  strcpy(w + 1, s[a[1]] + 1);
  for (int i = 2; i <= m; i++) {
    if (strlen(s[a[i]] + 1) != strlen(w + 1)) {
      Q = false;
      break;
    } else
      l = strlen(w + 1);
    for (int j = 1; j <= l; j++)
      if (w[j] != s[a[i]][j]) w[j] = '?';
  }
  for (int i = 1; i <= n; i++)
    if (!vis[i]) {
      if (strlen(s[i] + 1) != strlen(w + 1)) continue;
      l = strlen(w + 1);
      q = false;
      for (int j = 1; j <= l; j++)
        if (s[i][j] != w[j] && w[j] != '?') {
          q = true;
          break;
        }
      if (!q) {
        Q = false;
        break;
      }
    }
  if (Q)
    printf("Yes\n%s\n", w + 1);
  else
    printf("No\n");
  return 0;
}
