#include <bits/stdc++.h>
using namespace std;
const int M = 105;
bool visit[M];
string second[M];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) cin >> second[i];
  vector<string> v;
  for (int i = 0; i < m; i++) {
    int x;
    scanf("%d", &x);
    visit[x] = 1;
    v.push_back(second[x]);
  }
  for (int i = 1; i < m; i++) {
    if (v[i].size() != v[0].size()) {
      cout << "No";
      return 0;
    }
  }
  string pattern = "";
  for (int i = 0; i < v[0].size(); i++) {
    set<char> c;
    for (int j = 0; j < m; j++) c.insert(v[j][i]);
    if (c.size() == 1)
      pattern += *c.begin();
    else
      pattern += '?';
  }
  for (int i = 1; i <= n; i++) {
    if (second[i].size() != pattern.size()) continue;
    bool match = 1;
    for (int j = 0; j < second[i].size(); j++) {
      if (pattern[j] != second[i][j] && pattern[j] != '?') {
        match = 0;
        break;
      }
    }
    if (match && !visit[i]) {
      cout << "No";
      return 0;
    }
  }
  cout << "Yes\n" << pattern;
  return 0;
}
