#include <bits/stdc++.h>
using namespace std;
const long long N = 300300;
long long n, m, len;
string s;
long long cnt = 0;
bool flag = 1, pd[N];
struct Tree {
  int vis[3], ed = 0;
} dic[N];
void build(string s) {
  int now = 0;
  for (int i = 0; i < s.length(); i++) {
    if (dic[now].vis[s[i] - 'a'] == 0) {
      dic[now].vis[s[i] - 'a'] = ++cnt;
    }
    now = dic[now].vis[s[i] - 'a'];
  }
  dic[now].ed++;
}
bool dfs(long long at, long long now) {
  if (at == len) {
    if (dic[now].ed && !flag) return true;
    return false;
  }
  long long tmp = s[at] - 'a';
  for (long long i = 0; i < 3; i++)
    if (dic[now].vis[i]) {
      if (i == tmp) {
        if (dfs(at + 1, dic[now].vis[i])) return true;
      } else if (flag) {
        flag = 0;
        if (dfs(at + 1, dic[now].vis[i])) return true;
        flag = 1;
      }
    }
  return false;
}
int main() {
  scanf("%lld%lld", &n, &m);
  for (long long i = 0; i < n; i++) {
    cin >> s;
    build(s);
  }
  for (long long i = 0; i < m; i++) {
    flag = 1;
    cin >> s;
    len = s.length();
    long long a = 0, b = 0;
    if (dfs(a, b))
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
