#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, n, m, j, k;
  cin >> n >> m;
  string s[n];
  int a[m];
  for (i = 0; i < n; i++) {
    cin >> s[i];
  }
  for (i = 0; i < m; i++) {
    cin >> a[i];
  }
  int len = s[a[0] - 1].size();
  string str = s[a[0] - 1];
  for (i = 1; i < m; i++) {
    if (s[a[i] - 1].size() != len) {
      cout << "No\n";
      return 0;
    }
    for (j = 0; j < len; j++) {
      if (s[a[i] - 1][j] != str[j] && str[j] != '?') {
        str[j] = '?';
      }
    }
  }
  j = 0;
  for (i = 0; i < n; i++) {
    if (i == (a[j] - 1)) {
      j++;
      continue;
    }
    if (s[i].size() != len) {
      continue;
    }
    int no = 0;
    for (k = 0; k < len; k++) {
      if (s[i][k] != str[k] && str[k] != '?') {
        no = 1;
        break;
      }
    }
    if (no == 1) {
      continue;
    } else if (no == 0) {
      cout << "No\n";
      return 0;
    }
  }
  cout << "Yes\n";
  cout << str << "\n";
}
