#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6;
const long long mod = 1e9 + 7;
const long long INF = 10000000;
void flash() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cout.setf(ios::fixed);
  cout.setf(ios::showpoint);
  cout.precision(9);
}
void solve();
int32_t main() {
  flash();
  long long t;
  t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
void solve() {
  long long n, m;
  cin >> n >> m;
  string s[n];
  long long minh = 1e9;
  for (long long i = 0; i < n; i++) {
    cin >> s[i];
  }
  long long a[m];
  map<long long, long long> mp;
  for (long long i = 0; i < m; i++) {
    long long x;
    cin >> x;
    a[i] = x - 1;
    mp[a[i]] = 1;
    if (i == 0) {
      minh = s[a[i]].length();
    } else if (minh != s[a[i]].length()) {
      cout << "No\n";
      return;
    }
  }
  string s1;
  for (long long j = 0; j < minh; j++) {
    char ch = s[a[0]][j];
    bool ok = 1;
    for (long long i = 0; i < m; i++) {
      if (ch != s[a[i]][j]) {
        ok = 0;
        break;
      }
    }
    if (ok == 1) {
      s1 += ch;
    } else
      s1 += '?';
  }
  for (long long i = 0; i < n; i++) {
    if (mp[i] == 0 && s1.length() == s[i].length()) {
      bool ok = 0;
      for (long long j = 0; j < s1.length(); j++) {
        if (s1[j] != '?' && s[i][j] != s1[j]) {
          ok = 1;
          break;
        }
      }
      if (ok == 0) {
        cout << "No\n";
        return;
      }
    }
  }
  cout << "Yes\n";
  cout << s1;
  return;
}
