#include <bits/stdc++.h>
using namespace std;
char str[110][110];
int a[110];
bool dlt[110];
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%s", str[i]);
  for (int i = 1; i <= m; i++) {
    scanf("%d", &a[i]);
    dlt[a[i]] = true;
  }
  bool flag = true;
  char temp[110];
  strcpy(temp, str[a[1]]);
  int _len = strlen(temp);
  for (int i = 2; i <= m; i++) {
    int len = strlen(str[a[i]]);
    if (len != _len) {
      flag = false;
      break;
    }
    for (int j = 0; j < len; j++) {
      if (temp[j] != '?' && temp[j] != str[a[i]][j]) temp[j] = '?';
    }
  }
  if (flag) {
    for (int i = 1; i <= n; i++) {
      if (!dlt[i]) {
        int len = strlen(str[i]);
        if (len == _len) {
          bool t = true;
          for (int j = 0; j < len; j++) {
            if (temp[j] != '?' && temp[j] != str[i][j]) {
              t = false;
              break;
            }
          }
          if (t) {
            flag = false;
            break;
          }
        }
      }
    }
  }
  if (flag)
    cout << "Yes\n" << temp;
  else
    cout << "No";
}
