#include <bits/stdc++.h>
using namespace std;
map<long long, long long> mp;
void Hash(string str, long long B, long long mod) {
  long long power = 1, h = 0;
  long long m = (int)str.length();
  for (long long i = m - 1; i >= 0; i--) {
    h = h + (power * (str[i] - 'a' + 1)) % mod;
    h = h % mod;
    power = (power * B) % mod;
  }
  mp[h]++;
}
bool match(string str, long long B, long long mod) {
  long long power = 1, h = 0;
  long long m = (int)str.length();
  for (long long i = m - 1; i >= 0; i--) {
    h = h + (power * (str[i] - 'a' + 1)) % mod;
    h = h % mod;
    power = (power * B) % mod;
  }
  power = 1;
  for (long long i = m - 1; i >= 0; i--) {
    long long t1, t2;
    if (str[i] == 'a') {
      t1 = h + power;
      t1 = t1 % mod;
      t2 = t1 + power;
      t2 = t2 % mod;
    } else if (str[i] == 'b') {
      t1 = h - power;
      t1 = (t1 + mod) % mod;
      t2 = h + power;
      t2 = (t2 + mod) % mod;
    } else {
      t1 = h - power;
      t1 = (t1 + mod) % mod;
      t2 = t1 - power;
      t2 = (t2 + mod) % mod;
    }
    power = (power * B) % mod;
    if (mp[t1] != 0) return true;
    if (mp[t2] != 0) return true;
  }
  return false;
}
int main() {
  long long B[10], mod[10];
  B[0] = 137, B[1] = 347;
  mod[0] = 100404001, mod[1] = 1000000007;
  int n, m;
  scanf("%d %d", &n, &m);
  string str[n], query[m];
  for (int i = 0; i < n; i++) cin >> str[i];
  for (int i = 0; i < m; i++) cin >> query[i];
  bool ans[m];
  memset(ans, true, sizeof ans);
  for (int i = 0; i < 2; i++) {
    mp.clear();
    for (int j = 0; j < n; j++) {
      Hash(str[j], B[i], mod[i]);
    }
    for (int j = 0; j < m; j++) {
      if (match(query[j], B[i], mod[i]) == false) ans[j] = false;
    }
  }
  for (int j = 0; j < m; j++) {
    if (ans[j])
      printf("YES\n");
    else
      printf("NO\n");
  }
}
