#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, n, m, j, k, flag1 = 0, ldeleted;
  cin >> n >> m;
  char a[n][101];
  char toBeDeleted[m][101];
  char notDeleted[n - m][101];
  int deletedFiles[m];
  int lengthToBeDeleted[m], lengthNotDeleted[n - m];
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 0; i < m; i++) cin >> deletedFiles[i];
  j = 0;
  k = 0;
  for (i = 0; i < n; i++) {
    if (i + 1 == deletedFiles[j]) {
      strcpy(toBeDeleted[j], a[i]);
      j++;
    } else {
      strcpy(notDeleted[k], a[i]);
      k++;
    }
  }
  for (i = 0; i < m; i++) {
    lengthToBeDeleted[i] = strlen(toBeDeleted[i]);
  }
  for (i = 0; i < n - m; i++) {
    lengthNotDeleted[i] = strlen(notDeleted[i]);
  }
  for (i = 1; i < m; i++) {
    if (lengthToBeDeleted[i] != lengthToBeDeleted[0]) flag1 = 1;
  }
  if (flag1 == 1) {
    cout << "No" << endl;
    return 0;
  } else
    ldeleted = lengthToBeDeleted[0];
  int flag[ldeleted];
  for (i = 0; i < ldeleted; i++) flag[i] = 0;
  for (i = 0; i < ldeleted; i++) {
    for (j = 1; j < m; j++) {
      if (toBeDeleted[j][i] != toBeDeleted[0][i]) flag[i] = 1;
    }
  }
  flag1 = 0;
  for (i = 0; i < ldeleted; i++) {
    if (flag[i] == 0) flag1 = 1;
  }
  for (i = 0; i < n - m; i++) {
    if (lengthNotDeleted[i] == ldeleted) {
      if (flag1 == 0) {
        cout << "No" << endl;
        return 0;
      }
      flag1 = 0;
      for (j = 0; j < ldeleted; j++) {
        if ((flag[j] == 0) && (notDeleted[i][j] != toBeDeleted[0][j]))
          flag1 = 1;
      }
      if (flag1 == 0) {
        cout << "No" << endl;
        return 0;
      }
    }
  }
  cout << "Yes" << endl;
  for (i = 0; i < ldeleted; i++) {
    if (flag[i] == 0)
      cout << toBeDeleted[0][i];
    else
      cout << "?";
  }
  cout << endl;
  return 0;
}
