#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return !b ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return a * (b / gcd(a, b)); }
int main() {
  ios_base::sync_with_stdio(false);
  int n, m;
  cin >> n >> m;
  vector<string> vec(n);
  vector<bool> ar(n, 0);
  for (int i = 0; i < n; ++i) cin >> vec[i];
  string ans = "";
  int sz = -1;
  for (int x, i = 0; i < m; ++i) {
    cin >> x;
    --x;
    ar[x] = 1;
    if (sz == -1) sz = vec[x].size();
    if (vec[x].size() != sz) {
      cout << "No";
      return 0;
    }
  }
  for (int i = 0; i < sz; ++i) {
    char x = '@';
    for (int j = 0; j < n; ++j) {
      if (!ar[j]) continue;
      if (x == '@') x = vec[j][i];
      if (vec[j][i] != x) {
        x = '?';
        break;
      }
    }
    ans.push_back(x);
  }
  for (int i = 0; i < n; ++i) {
    if (ar[i] || vec[i].size() != sz) continue;
    int cnt = 0;
    for (int j = 0; j < sz; ++j) {
      if (ans[j] == '?' || (ans[j] != '?' && ans[j] == vec[i][j])) cnt++;
    }
    if (cnt == sz) {
      cout << "No";
      return 0;
    }
  }
  cout << "Yes\n" + ans;
  return 0;
}
