#include <bits/stdc++.h>
using namespace std;
int main() {
  int m, n, Len;
  cin >> n >> m;
  string s[n + 1];
  int len[n + 1];
  short flag[n + 1], Flag = 0, flag_q = 0, flag1 = 0;
  int i = 1, j, a;
  int A[m + 1];
  char c;
  while (i <= n) {
    getline(cin, s[i]);
    len[i] = s[i].length();
    if (!len[i]) {
      getline(cin, s[i]);
      len[i] = s[i].length();
    }
    flag[i] = 0;
    i++;
  }
  j = 1;
  while (j <= m) {
    cin >> a;
    A[j] = a;
    flag[a] = 1;
    if (j == 1)
      Len = s[a].length();
    else {
      if (len[a] != Len) Flag = 1;
    }
    j++;
  }
  j = 1;
  char str[Len];
  if (!Flag) {
    for (j = 0; j < Len; j++) {
      str[j] = '?';
    }
    for (j = 0; j < Len; j++) {
      flag_q = 0;
      c = s[A[1]][j];
      for (i = 1; i <= m; i++) {
        if (s[A[i]][j] != c) flag_q = 1;
      }
      if (!flag_q) str[j] = c;
    }
  }
  int B[n - m + 1];
  j = 1;
  for (i = 1; i <= n; i++) {
    if (flag[i] == 0) {
      B[j++] = i;
    }
  }
  for (i = 1; i <= n - m; i++) {
    if (len[B[i]] != Len) {
      continue;
    }
    flag_q = 0;
    for (j = 0; j < Len; j++) {
      if (s[B[i]][j] != str[j] && str[j] != '?') {
        flag_q = 1;
        continue;
      }
    }
    if (flag_q == 0) {
      flag1 = 1;
    }
  }
  if (Flag == 1 || flag1 == 1)
    cout << "No\n";
  else {
    cout << "Yes\n";
    for (i = 0; i < Len; i++) cout << str[i];
    cout << "\n";
  }
}
