#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  vector<string> fn(n);
  for (auto& i : fn) {
    cin >> i;
    for (auto& j : i) {
      if (j == '.') j = 'A';
    }
  }
  vector<string> f2d;
  int size = 0;
  int mm = m;
  while (mm--) {
    int foo;
    cin >> foo;
    --foo;
    f2d.push_back(fn[foo]);
    if (size == 0) {
      size = fn[foo].size();
    }
    if (fn[foo].size() != size) {
      cout << "No\n";
      return 0;
    }
  }
  string pattern(size, '.');
  for (int i = 0; i < size; i++) {
    char ch = f2d[0][i];
    int j;
    for (j = 1; j < m; j++) {
      if (f2d[j][i] != ch) {
        break;
      }
    }
    if (j == m) {
      pattern[i] = ch;
    }
  }
  regex txt_regex(pattern);
  int cnt = 0;
  for (const auto& i : fn) {
    cnt += regex_match(i, txt_regex);
  }
  if (cnt == m) {
    cout << "Yes\n";
    for (auto& cc : pattern) {
      if (cc == 'A')
        cc = '.';
      else if (cc == '.')
        cc = '?';
    }
    cout << pattern << endl;
  } else
    cout << "No\n";
}
