#include <bits/stdc++.h>
using namespace std;
const int N = (int)2e5 + 228;
const int INF = (int)1e9 + 228;
int a[N];
bool used[N];
string v[N];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> v[i];
  }
  for (int i = 0; i < m; i++) {
    cin >> a[i];
    a[i]--;
    used[a[i]] = true;
  }
  int sz = v[a[0]].size();
  for (int i = 1; i < m; i++) {
    if (v[a[i]].size() != sz) {
      cout << "No";
      return 0;
    }
  }
  string ans = "";
  for (int i = 0; i < sz; i++) {
    bool f = true;
    char c = v[a[0]][i];
    for (int j = 1; j < m; j++) {
      if (v[a[j]][i] != c) {
        f = false;
      }
    }
    if (f) {
      ans.push_back(c);
    } else {
      ans.push_back('?');
    }
  }
  vector<string> nahui;
  for (int i = 0; i < n; i++) {
    if (!used[i]) {
      nahui.push_back(v[i]);
    }
  }
  for (int i = 0; i < n - m; i++) {
    if (nahui[i].size() != sz) {
      continue;
    }
    bool f = true;
    for (int j = 0; j < sz; j++) {
      if (nahui[i][j] != ans[j] && ans[j] != '?') {
        f = false;
      }
    }
    if (f) {
      cout << "No";
      return 0;
    }
  }
  cout << "Yes\n" << ans;
  return 0;
}
