#include <bits/stdc++.h>
using namespace std;
const int inf = 0x20202020;
const long long mod = 1000000007;
const double eps = 1e-9;
const double pi = acos(-1);
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
const int N = 100;
int n, m;
char str[N + 5][N + 5];
int a[N + 5];
bool b[N + 5];
void input() {
  scanf("%d %d", &n, &m);
  for (int i = (0), i_end_ = (n); i < i_end_; ++i) scanf("%s", str[i]);
  memset(b, false, sizeof b);
  for (int i = (0), i_end_ = (m); i < i_end_; ++i) {
    scanf("%d", &a[i]);
    --a[i];
    b[a[i]] = true;
  }
}
char ans[N + 5];
int main() {
  input();
  int len = strlen(str[a[0]]);
  for (int i = (1), i_end_ = (m); i < i_end_; ++i)
    if (strlen(str[a[i]]) != len) {
      puts("No");
      return 0;
    }
  for (int i = (0), i_end_ = (len); i < i_end_; ++i) {
    char c = str[a[0]][i];
    for (int j = (1), j_end_ = (m); j < j_end_; ++j)
      if (str[a[j]][i] != c) {
        c = '?';
        break;
      }
    ans[i] = c;
  }
  for (int i = (0), i_end_ = (n); i < i_end_; ++i)
    if (!b[i]) {
      int l = strlen(str[i]);
      if (l != len) continue;
      bool same = true;
      for (int j = (0), j_end_ = (len); j < j_end_; ++j)
        if (str[i][j] != ans[j] && ans[j] != '?') {
          same = false;
          break;
        }
      if (same) {
        puts("No");
        return 0;
      }
    }
  puts("Yes");
  puts(ans);
  return 0;
}
