#include <bits/stdc++.h>
using namespace std;
vector<int> ind;
vector<string> a;
vector<string> v;
string s;
int n, m, x, z = 0;
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> s;
    v.push_back(s);
  }
  for (int i = 0; i < m; i++) {
    cin >> x;
    if (i > 0) {
      if (a[i - 1].length() != v[x - 1].length()) {
        cout << "No";
        return 0;
      }
    }
    a.push_back(v[x - 1]);
    ind.push_back(x - 1);
  }
  for (int i = 0; i < a.size() - 1; i++) {
    for (int j = 0; j < a[0].length(); j++) {
      if (a[i][j] != a[i + 1][j]) {
        a[i][j] = '?';
        a[i + 1][j] = '?';
      }
    }
  }
  string ans = a[a.size() - 1];
  for (int i = 0; i < v.size(); i++) {
    while (ind[z] < i && z < m - 1) z++;
    if (i != ind[z] && v[i].length() == ans.length()) {
      int ct = 0;
      for (int j = 0; j < ans.length(); j++) {
        if (v[i][j] == ans[j] || ans[j] == '?') {
          ct++;
        }
      }
      if (ct == ans.length()) {
        cout << "No";
        return 0;
      }
    }
  }
  cout << "Yes\n";
  cout << ans;
}
