#include <bits/stdc++.h>
using namespace std;
template <typename A, typename B>
string to_string(pair<A, B> p);
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p);
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p);
string to_string(const string& second) { return '"' + second + '"'; }
string to_string(char c) {
  string second;
  second += c;
  return second;
}
string to_string(const char* second) { return to_string((string)second); }
string to_string(bool b) { return (b ? "1" : "0"); }
string to_string(vector<bool> v) {
  bool first = true;
  string res = "{";
  for (long long i = 0; i < static_cast<long long>(v.size()); i++) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(v[i]);
  }
  res += "}";
  return res;
}
template <size_t N>
string to_string(bitset<N> v) {
  string res = "";
  for (size_t i = 0; i < N; i++) {
    res += static_cast<char>('0' + v[i]);
  }
  return res;
}
template <typename A>
string to_string(A v) {
  bool first = true;
  string res = "{";
  for (const auto& x : v) {
    if (!first) {
      res += ", ";
    }
    first = false;
    res += to_string(x);
  }
  res += "}";
  return res;
}
template <typename A, typename B>
string to_string(pair<A, B> p) {
  return "(" + to_string(p.first) + ", " + to_string(p.second) + ")";
}
template <typename A, typename B, typename C>
string to_string(tuple<A, B, C> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " +
         to_string(get<2>(p)) + ")";
}
template <typename A, typename B, typename C, typename D>
string to_string(tuple<A, B, C, D> p) {
  return "(" + to_string(get<0>(p)) + ", " + to_string(get<1>(p)) + ", " +
         to_string(get<2>(p)) + ", " + to_string(get<3>(p)) + ")";
}
void debug_out() { cerr << "\n"; }
template <typename Head, typename... Tail>
void debug_out(Head H, Tail... T) {
  cerr << " " << to_string(H);
  debug_out(T...);
}
void Clearing_out() { return; }
template <typename Head, typename... Tail>
void Clearing_out(Head& H, Tail&... T) {
  H.clear();
  Clearing_out(T...);
}
struct custom_hash {
  static uint64_t splitmix64(uint64_t x) {
    x += 0x9e3779b97f4a7c15;
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9;
    x = (x ^ (x >> 27)) * 0x94d049bb133111eb;
    return x ^ (x >> 31);
  }
  size_t operator()(uint64_t x) const {
    static const uint64_t FIXED_RANDOM =
        chrono::steady_clock::now().time_since_epoch().count();
    return splitmix64(x + FIXED_RANDOM);
  }
};
void time() {
  cerr << "Time elapsed: " << 1.0 * clock() / CLOCKS_PER_SEC << " s.\n";
}
void hi() {
  static long long i = 0;
  cerr << "Check Point : " << ++i << "\n";
  return;
}
long long stoi1(string str) {
  bool negative;
  if (str[0] == '-') {
    negative = true;
    str = str.substr(1);
  } else {
    negative = false;
  }
  long long n = str.length();
  long long number = 0;
  long long pos = 1;
  for (long long i = n - 1; i >= 0; i--) {
    number = number + (str[i] - '0') * pos;
    pos = pos * 10;
  }
  if (negative) number = -number;
  return number;
}
long long power(long long a, long long n) {
  long long res = 1;
  while (n > 0) {
    if (n % 2 != 0) {
      res = res * a;
      n--;
    } else if (n % 2 == 0) {
      a = a * a;
      n = n / 2;
    }
  }
  return res;
}
const long long max_size = 1e6 + 10000;
const double eps = 1e-18;
signed main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long t;
  t = 1;
  while (t--) {
    long long n, m;
    cin >> n >> m;
    vector<string> v_string(n);
    for (long long i = 0; i < n; i++) {
      cin >> v_string[i];
    }
    vector<long long> v_index(m);
    for (long long i = 0; i < m; i++) {
      cin >> v_index[i];
      v_index[i]--;
    }
    vector<string> v;
    for (long long i = 0; i < m; i++) {
      v.push_back(v_string[v_index[i]]);
    }
    bool same_length = true;
    for (long long i = 0; i + 1 < (long long)v.size(); i++) {
      if (v[i].length() != v[i + 1].length()) {
        same_length = false;
        break;
      }
    }
    if (!same_length) {
      cout << "No"
           << "\n";
      continue;
    }
    long long lenght_pattern = v[0].length();
    string str_ans = v[0];
    for (long long i = 1; i < (long long)v.size(); i++) {
      for (long long j = 0; j < lenght_pattern; j++) {
        if (str_ans[j] != '?' && str_ans[j] != v[i][j]) str_ans[j] = '?';
      }
    }
    unordered_set<long long, custom_hash> un_st;
    for (long long i = 0; i < (long long)v_index.size(); i++) {
      un_st.insert(v_index[i]);
    }
    unordered_set<long long> un_st_remain;
    for (long long i = 0; i < n; i++) {
      if (un_st.count(i) > 0) {
      } else {
        un_st_remain.insert(i);
      }
    }
    bool match = false;
    for (auto i : un_st_remain) {
      if (v_string[i].length() != lenght_pattern) continue;
      match = true;
      for (long long j = 0; j < lenght_pattern; j++) {
        if (str_ans[j] != '?' && str_ans[j] != v_string[i][j]) {
          match = false;
          break;
        }
      }
      if (match) {
        cout << "No"
             << "\n";
        return 0;
      }
    }
    cout << "Yes"
         << "\n";
    cout << str_ans << "\n";
  }
  time();
  return 0;
}
