#include <bits/stdc++.h>
using namespace std;
struct HashNode {
  int next;
  string str;
} hashnode[2000000];
int hashpre[5000007], hashcnt;
string str;
void hash_insert(unsigned long long key) {
  int hashkey = key % 5000007;
  for (int p = hashpre[hashkey]; p != -1; p = hashnode[p].next) {
    string nkey = hashnode[p].str;
    if (nkey == str) {
      return;
    }
  }
  hashnode[hashcnt].str = str;
  hashnode[hashcnt].next = hashpre[hashkey];
  hashpre[hashkey] = hashcnt++;
}
int hash_find(unsigned long long x) {
  int hashkey = x % 5000007;
  for (int p = hashpre[hashkey]; p != -1; p = hashnode[p].next) {
    string nkey = hashnode[p].str;
    if (nkey == str) {
      return true;
    }
  }
  return false;
}
unsigned long long savetmp[1001000];
int main(int argc, const char* argv[]) {
  int n, m;
  scanf("%d%d", &n, &m);
  hashcnt = 0;
  memset(hashpre, -1, sizeof(hashpre));
  for (int i = 0; i < n; i++) {
    cin >> str;
    int len = str.length();
    unsigned long long tmp = 1;
    unsigned long long sum = 0;
    for (int j = 0; j < len; j++) {
      sum += tmp * (str[j] - 'a' + 1);
      tmp *= 31;
    }
    hash_insert(sum);
  }
  for (int i = 0; i < m; i++) {
    cin >> str;
    int len = str.length();
    unsigned long long tmp = 1;
    for (int j = 0; j < len; j++) {
      savetmp[j] = tmp * (str[j] - 'a' + 1);
      tmp *= 31;
    }
    savetmp[len] = 0;
    for (int j = len - 1; j >= 0; j--) savetmp[j] += savetmp[j + 1];
    int flag = 0;
    tmp = 1;
    unsigned long long sum = 0;
    for (int j = 0; j < len; j++) {
      char c = str[j];
      for (char k = 'a'; k <= 'c'; k++) {
        if (k == c) continue;
        str[j] = k;
        if (hash_find(sum + tmp * (k - 'a' + 1) + savetmp[j + 1])) {
          flag = 1;
          break;
        }
      }
      str[j] = c;
      sum += tmp * (str[j] - 'a' + 1);
      tmp *= 31;
      if (flag) break;
    }
    if (flag)
      printf("YES\n");
    else
      printf("NO\n");
  }
  return 0;
}
