#include <bits/stdc++.h>
using namespace std;
string s[200];
bool vis[200];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    cin >> s[i];
  }
  string ans = "";
  int x;
  cin >> x;
  ans = s[x];
  vis[x] = 1;
  bool flag = 1;
  for (int i = 1; i < m; i++) {
    cin >> x;
    vis[x] = 1;
    if (ans.length() != s[x].length()) {
      flag = 0;
      break;
    }
    for (int j = 0; j < ans.length(); j++) {
      if (ans[j] != '?' && ans[j] != s[x][j]) {
        ans[j] = '?';
      }
    }
  }
  if (flag) {
    for (int i = 1; i <= n; i++) {
      if (!vis[i]) {
        if (ans.length() == s[i].length()) {
          int cnt = 0;
          for (int j = 0; j < ans.length(); j++) {
            if (ans[j] == s[i][j] || ans[j] == '?') {
              cnt++;
            }
          }
          if (cnt == ans.length()) {
            flag = 0;
            break;
          }
        }
      }
    }
  }
  if (flag) {
    cout << "Yes" << endl;
    cout << ans << endl;
  } else {
    cout << "No" << endl;
  }
}
