#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000000000000003;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
const int N = 601000;
int n, m;
long long pw[N];
char s[N];
unordered_set<long long> ff;
int main() {
  scanf("%d%d", &n, &m);
  pw[0] = 1;
  for (int i = 1; i < 600001; i++) pw[i] = pw[i - 1] * 3 % mod;
  for (int i = 0; i < n; i++) {
    scanf("%s", s);
    int l = strlen(s);
    long long hs = 0;
    for (int j = 0; j < l; j++) hs = (hs * 3 + s[j] - 'a') % mod;
    ff.insert(hs);
  }
  for (int i = 0; i < m; i++) {
    scanf("%s", s);
    int l = strlen(s);
    long long hs = 0;
    bool fg = 0;
    for (int j = 0; j < l; j++) hs = (hs * 3 + s[j] - 'a') % mod;
    for (int j = 0; j < l; j++) {
      long long nhs = (hs - (s[l - 1 - j] - 'a') * pw[j]) % mod;
      if (nhs < 0) nhs += mod;
      for (int k = 0; k < 3; k++)
        if (s[l - 1 - j] - 'a' != k) {
          if (ff.count((nhs + k * pw[j]) % mod)) fg = 1;
        }
      if (fg) break;
    }
    puts(fg ? "YES" : "NO");
  }
}
