#include <bits/stdc++.h>
using namespace std;
const int LEN = 600010;
const int X1 = 4243;
const int MOD1 = int(1e9) + 7;
const int X2 = 10007;
const int MOD2 = 42424243;
struct hashh {
  int a, b;
  hashh() {}
  hashh(int a) : a(a), b(a) {}
  hashh(int a, int b) : a(a), b(b) {}
};
bool operator<(const hashh& a, const hashh& b) {
  if (a.a != b.a) {
    return a.a < b.a;
  }
  return a.b < b.b;
}
bool operator==(const hashh& a, const hashh& b) {
  return a.a == b.a && a.b == b.b;
}
hashh operator*(const hashh& a, const hashh& b) {
  return hashh((1LL * a.a * b.a) % MOD1, (1LL * a.b * b.b) % MOD2);
}
hashh operator+(const hashh& a, const hashh& b) {
  hashh c(a.a + b.a, a.b + b.b);
  if (c.a >= MOD1) {
    c.a -= MOD1;
  }
  while (c.a < 0) c.a += MOD1;
  if (c.b >= MOD2) {
    c.b -= MOD2;
  }
  while (c.b < 0) c.b += MOD2;
  return c;
}
const hashh X(X1, X2);
hashh pw[LEN];
inline void init() {
  pw[0] = hashh(1);
  for (int i = 1; i < LEN; ++i) {
    pw[i] = pw[i - 1] * X;
  }
}
char str[600010];
int main() {
  init();
  int n, m;
  cin >> n >> m;
  map<hashh, int> mp;
  for (int i = 0; i < n; i++) {
    hashh temp(0);
    scanf("%s", str);
    int len = strlen(str);
    for (int j = 0; j < len; j++) {
      temp = (temp + pw[j] * str[j]);
    }
    mp.insert(make_pair(temp, 1));
  }
  for (int i = 0; i < m; i++) {
    scanf("%s", str);
    int len = strlen(str);
    hashh temp(0);
    for (int j = 0; j < len; j++) {
      temp = (temp + pw[j] * str[j]);
    }
    bool found = false;
    for (int j = 0; j < len && !found; j++) {
      for (int k = 0; k < 3; k++) {
        if (str[j] - 'a' == k) continue;
        hashh cur = temp + pw[j] * (k + 'a' - str[j]);
        if (mp[cur] != 0) {
          found = true;
          break;
        }
      }
    }
    if (found)
      printf("YES\n");
    else
      printf("NO\n");
  }
}
