#include <bits/stdc++.h>
using namespace std;
const bool DEBUG = false;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  bool puede = true;
  int N, M;
  cin >> N >> M;
  unordered_set<int> conj;
  vector<string> cad(N);
  vector<int> index(M);
  for (int i = 0; i < N; i++) {
    cin >> cad[i];
    conj.insert(i);
  }
  for (int i = 0; i < M; i++) {
    cin >> index[i];
    index[i]--;
    conj.erase(index[i]);
  }
  for (int i = 0; i < M - 1; i++) {
    if (cad[index[i]].size() != cad[index[i + 1]].size()) puede = false;
  }
  if (!puede) {
    cout << "No\n";
    return 0;
  }
  bool band;
  string patron = "";
  int sz = cad[index[0]].size();
  if (DEBUG) {
    cout << cad[index[0]] << endl;
    cout << "SZ: " << sz << endl;
  }
  for (int i = 0; i < sz; i++) {
    band = true;
    for (int j = 0; j < M - 1; j++) {
      if (cad[index[j]][i] != cad[index[j + 1]][i]) {
        patron += "?";
        band = false;
      }
      if (!band) break;
    }
    if (band) patron += cad[index[0]][i];
  }
  for (auto &it : conj) {
    band = true;
    if (cad[it].size() != patron.size()) continue;
    for (int i = 0; i < patron.size(); i++) {
      if (patron[i] == '?') continue;
      if (patron[i] == cad[it][i]) continue;
      band = false;
      break;
    }
    if (band) {
      cout << "No\n";
      return 0;
    }
  }
  cout << "Yes\n" << patron << '\n';
  return 0;
}
