#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 111;
string s[MAXN];
bool mark[MAXN];
string ans;
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long n, m;
  cin >> n >> m;
  for (long long i = 0; i < n; i++) cin >> s[i];
  long long x = -1, pre = -1;
  for (long long i = 0; i < m; i++) {
    cin >> x;
    x--;
    if (i && s[x].size() != s[pre].size()) return cout << "No", 0;
    mark[x] = 1;
    pre = x;
  }
  long long k = s[x].size();
  string ans = "";
  for (long long i = 0; i < k; i++) {
    long long pre = -1;
    char ch;
    for (long long j = 0; j < n; j++) {
      if (mark[j]) {
        if (pre > -1) {
          if (s[j][i] != s[pre][i]) ch = '?';
        } else
          ch = s[j][i];
        pre = j;
      }
    }
    ans += ch;
  }
  for (long long i = 0; i < n; i++) {
    if (!mark[i] && s[i].size() == s[x].size()) {
      bool f = 1;
      for (long long j = 0; j < k; j++)
        if (ans[j] != '?' && ans[j] != s[i][j]) f = 0;
      if (f) return cout << "No", 0;
    }
  }
  cout << "Yes\n" << ans;
}
