#include <bits/stdc++.h>
using namespace std;
const int N = 105;
char str[N][N];
int a[N], vis[N], len;
char ans[N];
bool match(int i) {
  int l = strlen(str[i]);
  if (l != len) return 0;
  for (int j = 0; j < len; j++)
    if (ans[j] != '?' && str[i][j] != ans[j]) return 0;
  return 1;
}
int main() {
  int m, n;
  while (~scanf("%d%d", &n, &m)) {
    memset(vis, 0, sizeof(vis));
    for (int i = 1; i <= n; i++) scanf("%s", str[i]);
    for (int i = 0; i < m; i++) {
      scanf("%d", &a[i]);
      vis[a[i]] = 1;
    }
    bool flag = true;
    len = strlen(str[a[0]]);
    for (int i = 1; i < m; i++)
      if (len != strlen(str[a[i]])) flag = false;
    for (int i = 0; i < len; i++) ans[i] = str[a[0]][i];
    ans[len] = 0;
    for (int i = 1; i < m; i++)
      for (int j = 0; j < len; j++)
        if (str[a[i]][j] != ans[j]) ans[j] = '?';
    for (int i = 1; i <= n; i++)
      if (!vis[i]) {
        if (match(i)) flag = false;
      }
    if (flag) {
      cout << "Yes" << endl;
      cout << ans << endl;
    } else
      cout << "No" << endl;
  }
}
