#include <bits/stdc++.h>
using namespace std;
const int MAX = 6e5 + 5;
const long long mod = 2000004199, mod2 = 1111111111111;
const long long seed = 131, seed2 = 13331;
int n, m;
char s[MAX];
unsigned long long P[MAX], P2[MAX];
set<unsigned long long> ss, ss2;
int main() {
  P[0] = P2[0] = 1;
  for (int i = 1; i < MAX; i++)
    P[i] = P[i - 1] * seed % mod, P2[i] = P2[i - 1] * seed2 % mod2;
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    scanf("%s", s + 1);
    unsigned long long Hash = 0, Hash2 = 0;
    int len = strlen(s + 1);
    for (int j = 1; j <= len; j++)
      Hash = (Hash * seed + s[j] - 'a' + 1) % mod,
      Hash2 = (Hash2 * seed2 + s[j] - 'a' + 1) % mod2;
    ss.insert(Hash);
    ss2.insert(Hash2);
  }
  for (int i = 1; i <= m; i++) {
    scanf("%s", s + 1);
    unsigned long long Hash = 0, Hash2 = 0;
    int len = strlen(s + 1), flag = 0;
    for (int j = 1; j <= len; j++)
      Hash = (Hash * seed + s[j] - 'a' + 1) % mod,
      Hash2 = (Hash2 * seed2 + s[j] - 'a' + 1) % mod2;
    for (char ch = 'a'; ch <= 'c'; ch++) {
      for (int j = 1; j <= len; j++) {
        if (s[j] == ch) continue;
        if (ss.count((Hash + 10 * mod + (ch - s[j]) * P[len - j]) % mod) &&
            ss2.count((Hash2 + 10 * mod2 + (ch - s[j]) * P2[len - j]) % mod2)) {
          flag = 1;
          break;
        }
      }
    }
    if (flag == 1)
      puts("YES");
    else
      puts("NO");
  }
  return 0;
}
