#include <bits/stdc++.h>
using namespace std;
bool flag[110];
int main() {
  int Case = 1;
  int n, m, k;
  char dump[2];
  while (scanf("%d %d", &n, &m) == 2) {
    gets(dump);
    vector<string> files, toDelete;
    string s;
    memset(flag, false, sizeof(flag));
    for (int i = 1; i <= n; i++) {
      getline(cin, s);
      files.push_back(s);
    }
    for (int i = 1; i <= m; i++) {
      scanf("%d", &k);
      flag[k - 1] = true;
      toDelete.push_back(files[k - 1]);
    }
    bool possible = true;
    for (int i = 1; i < m; i++) {
      if (toDelete[0].size() != toDelete[i].size()) {
        possible = false;
      }
    }
    string ans = toDelete[0];
    for (int j = 0; possible && j < ans.size(); j++) {
      for (int i = 1; i < m; i++) {
        if (toDelete[i][j] != toDelete[i - 1][j]) {
          ans[j] = '?';
        }
      }
    }
    for (int i = 0; possible && i < n; i++) {
      if (!flag[i] && files[i].size() == ans.size()) {
        for (int j = 0; j < ans.size(); j++) {
          if (ans[j] == '?') {
            files[i][j] = '?';
          }
        }
        if (files[i] == ans) {
          possible = false;
        }
      }
    }
    if (possible) {
      printf("Yes\n%s\n", ans.c_str());
    } else {
      puts("No");
    }
  }
  return 0;
}
