#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  string s;
  vector<string> v(n, "");
  int del[m];
  for (int i = 0; i < n; i++) cin >> v[i];
  for (int i = 0; i < m; i++) {
    cin >> del[i];
    if (i != 0 && v[del[i] - 1].size() != v[del[i - 1] - 1].size()) {
      cout << "No";
      return 0;
    }
  }
  string mask = v[del[0] - 1];
  for (int i = 1; i < m; i++) {
    for (int j = 0; j < mask.size(); j++)
      if (mask[j] != v[del[i] - 1][j]) mask[j] = '?';
  }
  for (int i = 0; i < n; i++) {
    int flag = 0;
    for (int j = 0; j < m; j++)
      if (i == del[j] - 1) flag = 1;
    if (flag == 1) continue;
    if (v[i].size() != mask.size()) continue;
    int flag2 = 0;
    for (int j = 0; j < mask.size(); j++) {
      if (mask[j] != '?' && v[i][j] != mask[j]) flag2 = 1;
    }
    if (flag2 == 0) {
      cout << "No";
      return 0;
    }
  }
  cout << "Yes" << endl << mask;
  return 0;
}
