#include <bits/stdc++.h>
char A[110][110];
char ans[110];
int B[110];
int length[110];
int u[110];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%s", A[i]);
    length[i] = strlen(A[i]);
  }
  for (int i = 1; i <= m; i++) {
    scanf("%d", &B[i]);
    u[B[i]] = 1;
    if (i > 1) {
      if (length[B[i]] != length[B[i - 1]]) {
        printf("No");
        return 0;
      }
    }
  }
  int len = length[B[1]];
  for (int i = 0; i < len; i++) {
    int check = 0;
    for (int j = 1; j <= m; j++) {
      if (j > 1) {
        if (A[B[j]][i] != A[B[j - 1]][i]) {
          check = 1;
          break;
        }
      }
    }
    if (check)
      ans[i] = '?';
    else
      ans[i] = A[B[1]][i];
  }
  int j;
  for (int i = 1; i <= n; i++) {
    if (u[i]) continue;
    if (strlen(A[i]) != len) continue;
    for (j = 0; j < len; j++) {
      if (ans[j] == '?') continue;
      if (A[i][j] != ans[j]) break;
    }
    if (j == len) {
      printf("No");
      return 0;
    }
  }
  printf("Yes\n");
  printf("%s", ans);
}
