#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) { return (b == 0 ? a : gcd(b, a % b)); }
long long lcm(long long a, long long b) { return ((a * b) / gcd(a, b)); }
long long pw(long long b, long long p) {
  if (!p) return 1;
  long long sq = pw(b, p / 2);
  sq *= sq;
  if (p % 2) sq *= b;
  return sq;
}
long long sd(long long x) { return x < 10 ? x : x % 10 + sd(x / 10); }
double sq(double x) {
  for (long long i = 0; i < x; i++)
    if ((double)i * i > x) return (i - 1);
  return double(1);
}
struct trie {
  trie* child[3];
  bool isleaf;
  trie() {
    isleaf = 0;
    memset(child, 0, sizeof child);
  }
  void insert(string const& s, int i) {
    if (i == s.size())
      isleaf = 1;
    else {
      if (!child[s[i] - 'a']) child[s[i] - 'a'] = new trie;
      child[s[i] - 'a']->insert(s, i + 1);
    }
  }
  bool exist(string const& s, int i, bool one) {
    if (i == s.size()) return (isleaf && one);
    int go1, go2, go = s[i] - 'a';
    if (go == 0)
      go1 = 1, go2 = 2;
    else if (go == 1)
      go1 = 0, go2 = 2;
    else
      go1 = 0, go2 = 1;
    long long t1 = 0, t2 = 0, t3 = 0;
    if (child[go]) t1 = child[go]->exist(s, i + 1, one);
    if (!one && child[go1]) t2 = child[go1]->exist(s, i + 1, 1);
    if (!one && child[go2]) t3 = child[go2]->exist(s, i + 1, 1);
    return (t1 || t2 || t3);
  }
};
int main() {
  trie T;
  int n, m;
  cin >> n >> m;
  for (long long i = 0; i < n; i++) {
    string s;
    cin >> s;
    T.insert(s, 0);
  }
  for (long long i = 0; i < m; i++) {
    string s;
    cin >> s;
    if (T.exist(s, 0, 0))
      puts("YES");
    else
      puts("NO");
  }
}
