#include <bits/stdc++.h>
using namespace std;
int node[600005][3];
bool endPoint[600005];
char s[300005];
int nnode;
bool flag;
void Insert() {
  int now = 0;
  int len = strlen(s);
  for (int i = 0; i < len; i++) {
    int id = s[i] - 'a';
    if (!node[now][id]) node[now][id] = ++nnode;
    now = node[now][id];
  }
  endPoint[now] = true;
}
void solve(int curNode, int curIndex, int len, int changed) {
  if (flag) return;
  if (changed > 1) return;
  if (curIndex == len && changed == 1 && endPoint[curNode]) {
    flag = true;
    return;
  }
  for (int j = 0; j < 3; j++) {
    if (node[curNode][j] != 0) {
      if (s[curIndex] - 'a' == j)
        solve(node[curNode][j], curIndex + 1, len, changed);
      else
        solve(node[curNode][j], curIndex + 1, len, changed + 1);
    }
  }
}
int main() {
  int n, m;
  scanf("%d %d", &n, &m);
  while (n--) {
    scanf("%s", s);
    Insert();
  }
  while (m--) {
    scanf("%s", s);
    flag = false;
    solve(0, 0, strlen(s), 0);
    if (flag)
      printf("YES\n");
    else
      printf("NO\n");
  }
}
