#include <bits/stdc++.h>
using namespace std;
char str[105][105];
char s[105][105];
char ans[105];
int main() {
  int n, m;
  while (cin >> n >> m) {
    memset(ans, 0, sizeof(ans));
    for (int i = 0; i < n; i++) cin >> str[i];
    int x;
    int k = 0;
    int len = 0, flag = 0;
    for (int i = 0; i < m; i++) {
      cin >> x;
      x--;
      if (len == 0) {
        len = strlen(str[x]);
      } else {
        if (strlen(str[x]) != len) {
          flag = 1;
        }
      }
      strcpy(s[k++], str[x]);
    }
    if (flag) {
      cout << "No" << endl;
      continue;
    }
    for (int i = 0; i < len; i++) {
      char temp = s[0][i];
      int flagflag = 0;
      for (int j = 1; j < k; j++) {
        if (temp != s[j][i]) {
          flagflag = 1;
          break;
        }
      }
      if (flagflag) {
        ans[i] = '?';
      } else {
        ans[i] = temp;
      }
    }
    int cnt = 0;
    for (int i = 0; i < n; i++) {
      if (strlen(str[i]) == len) {
        int flagflag = 0;
        for (int j = 0; j < len; j++) {
          if (ans[j] == '?') continue;
          if (ans[j] != str[i][j]) {
            flagflag = 1;
            break;
          }
        }
        if (flagflag == 0) cnt++;
      }
    }
    if (cnt == m) {
      cout << "Yes" << endl;
      cout << ans << endl;
    } else {
      cout << "No" << endl;
    }
  }
  return 0;
}
