#include <bits/stdc++.h>
using namespace std;
unsigned long long save[(unsigned long long)1e6 + 5],
    save2[(unsigned long long)1e6 + 5];
unsigned long long prime = 113, prime2 = 257;
void pre() {
  save[0] = 1;
  save2[0] = 1;
  for (unsigned long long i = 1; i < (unsigned long long)1e6 + 5; i++) {
    save[i] = (save[i - 1] * prime) % (unsigned long long)1e15 + 7;
    save2[i] = (save2[i - 1] * prime2) % (unsigned long long)6e15 + 9;
  }
}
unsigned long long getHash(string s) {
  unsigned long long hashValue = 0;
  for (unsigned long long i = 0; i < s.size(); i++) hashValue += s[i] * save[i];
  return hashValue;
}
unsigned long long getHash2(string s) {
  unsigned long long hashValue = 0;
  for (unsigned long long i = 0; i < s.size(); i++)
    hashValue += s[i] * save2[i];
  return hashValue;
}
unsigned long long a[(unsigned long long)1e6 + 5],
    a2[(unsigned long long)1e6 + 5], idx;
bool test(unsigned long long hashValue, unsigned long long hashValue2, char ch,
          unsigned long long i) {
  hashValue += ch * save[i];
  hashValue2 += ch * save2[i];
  if (binary_search(a, a + idx, hashValue) &&
      binary_search(a2, a2 + idx, hashValue2))
    return true;
  return false;
}
bool checkHash(string s) {
  unsigned long long hashValue = getHash(s), hashValue2 = getHash2(s);
  for (unsigned long long i = 0; i < s.size(); i++) {
    hashValue -= s[i] * save[i];
    hashValue2 -= s[i] * save2[i];
    for (char ch = 'a'; ch <= 'c'; ch++) {
      if (s[i] != ch && test(hashValue, hashValue2, ch, i)) return true;
    }
    hashValue += s[i] * save[i];
    hashValue2 += s[i] * save2[i];
  }
  return false;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  unsigned long long n, m;
  cin >> n >> m;
  pre();
  string s;
  for (unsigned long long i = 0; i < n; i++) {
    cin >> s;
    a[idx++] = getHash(s);
    a2[idx - 1] = getHash2(s);
  }
  sort(a, a + idx);
  sort(a2, a2 + idx);
  while (m--) {
    cin >> s;
    if (checkHash(s))
      cout << "YES\n";
    else
      cout << "NO\n";
  }
}
