#include <bits/stdc++.h>
using namespace std;
int n, m;
char s[600005];
set<long long> se;
int main() {
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%s", s);
    int l = strlen(s);
    long long sum = 0, mul = 1;
    for (int j = 0; j < l; j++) {
      sum += mul * (s[j] - 'a' + 1);
      mul = (mul * 60887LL) % 13151715131LL;
    }
    mul = 1;
    for (int j = 0; j < l; j++) {
      long long tmp = sum - mul * (s[j] - 'a' + 1);
      if (s[j] != 'a') se.insert(tmp + mul);
      if (s[j] != 'b') se.insert(tmp + mul * 2);
      if (s[j] != 'c') se.insert(tmp + mul * 3);
      mul = (mul * 60887LL) % 13151715131LL;
    }
  }
  for (int i = 0; i < m; i++) {
    scanf("%s", s);
    int l = strlen(s);
    long long sum = 0, mul = 1;
    for (int j = 0; j < l; j++) {
      sum += mul * (s[j] - 'a' + 1);
      mul = (mul * 60887LL) % 13151715131LL;
    }
    printf(se.count(sum) ? "YES\n" : "NO\n");
  }
  return 0;
}
