#include <bits/stdc++.h>
using namespace std;
void readi(int &x) {
  int v = 0, f = 1;
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-')
    f = -1;
  else
    v = v * 10 + c - '0';
  while (isdigit(c = getchar())) v = v * 10 + c - '0';
  x = v * f;
}
void readll(long long &x) {
  long long v = 0ll, f = 1ll;
  char c = getchar();
  while (!isdigit(c) && c != '-') c = getchar();
  if (c == '-')
    f = -1;
  else
    v = v * 10 + c - '0';
  while (isdigit(c = getchar())) v = v * 10 + c - '0';
  x = v * f;
}
void readc(char &x) {
  char c;
  while ((c = getchar()) == ' ')
    ;
  x = c;
}
void writes(string s) { puts(s.c_str()); }
void writeln() { writes(""); }
void writei(int x) {
  if (!x) putchar('0');
  char a[25];
  int top = 0;
  while (x) {
    a[++top] = (x % 10) + '0';
    x /= 10;
  }
  while (top) {
    putchar(a[top]);
    top--;
  }
}
void writell(long long x) {
  if (!x) putchar('0');
  char a[25];
  int top = 0;
  while (x) {
    a[++top] = (x % 10) + '0';
    x /= 10;
  }
  while (top) {
    putchar(a[top]);
    top--;
  }
}
int n, m, k, i, j, a[123];
set<int> sl;
set<char> s[123];
string t[123];
string res;
bool sam(string s, string t) {
  if (s.size() != t.size()) return 0;
  int i;
  for (i = 0; i < s.size(); i++) {
    if (s[i] != '?' && t[i] != '?' && s[i] != t[i]) return 0;
  }
  return 1;
}
int main() {
  ios::sync_with_stdio(false);
  ;
  cin >> n >> m;
  for (i = 1; i <= n; i++) {
    cin >> t[i];
  }
  for (i = 1; i <= m; i++) {
    cin >> a[i];
  }
  stable_sort(a + 1, a + m + 1);
  for (i = 1; i <= n; i++)
    if (binary_search(a + 1, a + m + 1, i)) sl.insert(t[i].size());
  if (sl.size() > 1) {
    cout << "No";
    return 0;
  }
  for (i = 1; i <= n; i++)
    if (binary_search(a + 1, a + m + 1, i))
      for (j = 0; j < *sl.begin(); j++) {
        s[j].insert(t[i][j]);
      }
  for (i = 0; i < *sl.begin(); i++) {
    if (s[i].size() > 1)
      res += "?";
    else
      res.push_back(*s[i].begin());
  }
  for (i = 1; i <= n; i++) {
    if (binary_search(a + 1, a + m + 1, i) == 0) {
      if (sam(t[i], res)) {
        cout << "No";
        return 0;
      }
    }
  }
  cout << "Yes\n" << res;
  return 0;
}
