#include <bits/stdc++.h>
using namespace std;
const int MX = 1000002;
const long long MOD = 5783568129149;
int n, m;
unsigned long long po[MX + 5];
const unsigned long long P = 31;
string s;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cin >> n >> m;
  map<unsigned long long, bool> maap;
  po[0] = 1;
  for (int i = 1; i <= MX; ++i) {
    po[i] = (po[i - 1] * P) % MOD;
  }
  for (int i = (0); i <= (n - 1); i++) {
    cin >> s;
    int len = s.length();
    long long h = 0;
    for (int j = (0); j <= (len - 1); j++)
      h = (h + po[j] * (s[j] - 'a' + 1) % MOD) % MOD;
    maap[h] = 1;
  }
  for (int i = (0); i <= (m - 1); i++) {
    cin >> s;
    int len = s.length();
    bool yes = 0;
    unsigned long long h = 0;
    for (int j = (0); j <= (len - 1); j++)
      h = (h + po[j] * (s[j] - 'a' + 1) % MOD) % MOD;
    for (int j = (0); j <= (len - 1); j++) {
      for (int k = (0); k <= (2); k++) {
        if (k == s[j] - 'a') continue;
        unsigned long long hh =
            (h - po[j] * (s[j] - 'a' + 1) % MOD + MOD) % MOD;
        hh = (hh + po[j] * (k + 1) % MOD) % MOD;
        if (maap.find(hh) != maap.end()) {
          yes = 1;
          break;
        }
      }
      if (yes == 1) break;
    }
    if (yes)
      cout << "YES\n";
    else
      cout << "NO\n";
  }
  return 0;
}
