#include <bits/stdc++.h>
using namespace std;
int N, M, i, j;
string S;
vector<int> C;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> N >> M;
  string A[N];
  int B[M];
  for (i = 0; i < N; i++) {
    cin >> A[i];
  }
  for (i = 0; i < M; i++) {
    cin >> B[i];
    B[i]--;
    if (i > 0) {
      for (j = B[i - 1] + 1; j < B[i]; j++) {
        C.push_back(j);
      }
    } else
      for (j = 0; j < B[i]; j++) {
        C.push_back(j);
      }
  }
  for (j = B[i - 1] + 1; j < N; j++) {
    C.push_back(j);
  }
  for (i = 0; i < M; i++) {
    if (i > 0) {
      if (S.length() != A[B[i]].length()) {
        cout << "No" << endl;
        return 0;
      }
      for (j = 0; j < S.length(); j++) {
        if (S[j] != '?') {
          if (S[j] != A[B[i]][j]) {
            S[j] = '?';
          }
        }
      }
    } else
      S = A[B[0]];
  }
  for (i = 0; i < C.size(); i++) {
    if (S.length() == A[C[i]].length()) {
      for (j = 0; j <= S.length(); j++) {
        if (j == S.length()) {
          cout << "No" << endl;
          return 0;
        }
        if (S[j] != '?') {
          if (S[j] != A[C[i]][j]) {
            break;
          }
        }
      }
    }
  }
  cout << "Yes" << endl;
  cout << S << endl;
}
