#include <bits/stdc++.h>
using namespace std;
char str[110][110];
int op[110];
int visit[110];
int visit2[110];
vector<string> v1, v2;
int main() {
  int n, m;
  memset(visit, 0, sizeof visit);
  memset(visit2, 0, sizeof visit2);
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%s", &str[i]);
  for (int i = 1; i <= m; i++) {
    scanf("%d", &op[i]);
    visit2[op[i]] = 1;
  }
  int flag = 1;
  for (int i = 1; i < m; i++) {
    if (strlen(str[op[i]]) != strlen(str[op[i + 1]])) flag = 0;
  }
  if (!flag) {
    puts("No");
    return 0;
  }
  int len = strlen(str[op[1]]);
  int cur = 0;
  for (int i = 0; i < len; i++) {
    int f = 1;
    for (int j = 1; j < m; j++) {
      if (str[op[j]][i] != str[op[j + 1]][i]) {
        f = 0;
        break;
      }
    }
    if (f) {
      visit[i] = 1;
      cur++;
    }
  }
  if (!cur) {
    int F = 0;
    for (int i = 1; i <= n; i++) {
      if (strlen(str[i]) == strlen(str[op[1]]) && !visit2[i]) {
        F++;
      }
    }
    if (!F) {
      puts("Yes");
      for (int i = 0; i < len; i++) printf("?");
      printf("\n");
    } else
      puts("No");
    return 0;
  } else {
    for (int i = 1; i <= n; i++) {
      if (strlen(str[i]) == len && !visit2[i]) {
        int cur1 = 0;
        for (int j = 0; j < len; j++) {
          if (visit[j] && str[i][j] == str[op[1]][j]) {
            cur1++;
          }
        }
        if (cur1 == cur) {
          puts("No");
          return 0;
        }
      }
    }
    puts("Yes");
    for (int i = 0; i < len; i++) {
      if (visit[i])
        printf("%c", str[op[1]][i]);
      else
        printf("?");
    }
    printf("\n");
  }
  return 0;
}
