#include <bits/stdc++.h>
using namespace std;
template <class T>
T gcd(T a, T b) {
  return b ? gcd(b, a % b) : a;
}
const int maxn = 111;
int n, m, t, a[maxn], b[maxn];
string s[maxn], res;
void solve() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> s[i];
  }
  cin >> a[1];
  b[a[1]] = 1;
  int len = s[a[1]].size();
  for (int i = 2; i <= m; i++) {
    cin >> a[i];
    b[a[i]] = 1;
    if (s[a[i]].size() != len) {
      puts("No");
      return;
    }
  }
  for (int i = 0; i < len; i++) {
    char c = s[a[1]][i];
    bool b = 0;
    for (int j = 2; j <= m; j++) {
      if (s[a[j]][i] != c) {
        res += '?';
        b = 1;
        break;
      }
    }
    if (!b) {
      res += c;
    }
  }
  for (int i = 1; i <= n; i++) {
    if (b[i] || s[i].size() != len) continue;
    bool r = 0;
    for (int j = 0; j < len; j++) {
      if (res[j] == '?') continue;
      if (res[j] != s[i][j]) {
        r = 1;
        break;
      }
    }
    if (!r) {
      puts("No");
      return;
    }
  }
  puts("Yes");
  cout << res;
}
int main() { solve(); }
