#include <bits/stdc++.h>
using namespace std;
const int inf = 0x7f7f7f7f;
int dx[] = {-1, -1, -1, 0, 0, 1, 1, 1};
int dy[] = {-1, 0, 1, -1, 1, -1, 0, 1};
int mnth[] = {-1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
int main() {
  int n, m;
  cin >> n >> m;
  string s[1001];
  for (int i = 1; i <= n; i++) cin >> s[i];
  int del[101];
  bool seen[101] = {0};
  for (int i = 1; i <= m; i++) {
    cin >> del[i];
    seen[del[i]] = 1;
  }
  int len;
  for (int i = 1; i <= m; i++) {
    if (i == 1) {
      len = s[del[i]].size();
      continue;
    }
    if (len != s[del[i]].size()) {
      cout << "No" << endl;
      return 0;
    }
  }
  string ans;
  for (int i = 0; i < len; i++) {
    char ch;
    bool f = 0;
    for (int j = 1; j <= m; j++) {
      if (j == 1) {
        ch = s[del[j]][i];
        continue;
      }
      if (ch != s[del[j]][i]) {
        f = 1;
        ans += '?';
        break;
      }
    }
    if (f == 0) ans += ch;
  }
  for (int i = 1; i <= n; i++) {
    if (seen[i] == 0) {
      int len2 = s[i].size();
      if (len2 != len) continue;
      bool flag = 0;
      for (int j = 0; j < len; j++) {
        if (ans[j] == '?' || ans[j] == s[i][j]) continue;
        flag = 1;
        break;
      }
      if (flag == 0) {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
  cout << ans << endl;
  return 0;
}
