#include <bits/stdc++.h>
using namespace std;
const int N = 6 * 100005;
const long long p1 = 737;
const long long p2 = 3079;
const long long m1 = 1000000123;
const long long m2 = 1000000321;
vector<long long> p_pow1(N), p_pow2(N);
map<pair<long long, long long>, bool> mp;
void POW() {
  p_pow1[0] = 1;
  p_pow2[0] = 1;
  for (int i = 1; i < N; i++) {
    p_pow1[i] = (p_pow1[i - 1] * p1) % m1;
    p_pow2[i] = (p_pow2[i - 1] * p2) % m2;
  }
}
pair<long long, long long> Hash(string const& s) {
  int n = s.size();
  long long H1 = 0, H2 = 0;
  for (int i = 0; i < n; i++) {
    H1 = ((H1 * p1) % m1 + (s[i] - 'a' + 1)) % m1;
    H2 = ((H2 * p2) % m2 + (s[i] - 'a' + 1)) % m2;
  }
  return {H1, H2};
}
bool Check(string s) {
  pair<long long, long long> H = Hash(s);
  int n = s.size();
  for (int i = 0; i < n; i++) {
    for (char ch = 'a'; ch <= 'c'; ch++) {
      if (ch == s[i])
        continue;
      else {
        long long h1 =
            (H.first + ((ch - s[i]) * p_pow1[n - i - 1]) % m1 + m1) % m1;
        long long h2 =
            (H.second + ((ch - s[i]) * p_pow2[n - i - 1]) % m2 + m2) % m2;
        if (mp[{h1, h2}]) return true;
      }
    }
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  ;
  POW();
  int n, m;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    pair<long long, long long> H = Hash(s);
    mp[H] = true;
  }
  while (m--) {
    string s;
    cin >> s;
    if (Check(s))
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
