#include <bits/stdc++.h>
using namespace std;
int n, m;
int main() {
  vector<string> strs;
  vector<int> deleted;
  cin >> n >> m;
  strs.resize(n);
  deleted.resize(m);
  vector<int> all(n, 0);
  for (int i = 0; i < n; i++) {
    cin >> strs[i];
  }
  int deletedSize = -1;
  for (int i = 0; i < m; i++) {
    cin >> deleted[i];
    deleted[i]--;
    all[deleted[i]] = 1;
    if (deletedSize == -1)
      deletedSize = strs[deleted[i]].length();
    else {
      if (strs[deleted[i]].length() != deletedSize) {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  string pattern = strs[deleted[0]];
  for (int j = 0; j < deletedSize; j++) {
    for (int i = 0; i < m; i++) {
      if (pattern[j] != strs[deleted[i]][j]) {
        pattern[j] = '?';
      }
    }
  }
  for (int i = 0; i < n; i++) {
    if (all[i] != 1) {
      if (strs[i].length() != deletedSize) continue;
      bool same = true;
      for (int j = 0; j < deletedSize; j++) {
        if (pattern[j] != strs[i][j] && pattern[j] != '?') same = false;
      }
      if (same) {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
  cout << pattern << endl;
  return 0;
}
