#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.sync_with_stdio(false);
  long long N, M;
  string ans;
  cin >> N >> M;
  vector<string> strs(N);
  vector<long long> idx(M);
  set<long long> st;
  for (long long i = (long long)(0); i <= (long long)(N - 1); i++)
    cin >> strs[i];
  for (long long i = (long long)(0); i <= (long long)(M - 1); i++)
    cin >> idx[i], idx[i]--, st.insert(idx[i]);
  long long mx = 0;
  for (auto itr : idx) mx = (mx > strs[itr].size() ? mx : strs[itr].size());
  bool jd = true;
  for (long long j = (long long)(0); j <= (long long)(M - 1); j++)
    if (strs[idx[j]].size() != mx) jd = false;
  if (jd)
    for (long long i = (long long)(0); i <= (long long)(mx - 1); i++) {
      bool same = true;
      for (long long j = (long long)(0); j <= (long long)(M - 1 - 1); j++) {
        if (strs[idx[j]][i] != strs[idx[j + 1]][i]) same = false;
      }
      ans.push_back(same ? strs[idx[0]][i] : '?');
    }
  if (jd)
    for (long long i = (long long)(0); i <= (long long)(N - 1); i++) {
      if (st.count(i) || mx != strs[i].size()) continue;
      bool match = true;
      for (long long j = (long long)(0); j <= (long long)(mx - 1); j++) {
        if (strs[i][j] != ans[j] && ans[j] != '?') match = false;
      }
      if (match) jd = false;
    }
  if (jd) {
    cout << "Yes" << endl;
    cout << ans << endl;
  } else {
    cout << "No" << endl;
  }
  return 0;
}
