#include <bits/stdc++.h>
using namespace std;
struct node {
  int child[3];
  bool is_end = 0;
};
class zds {
 public:
  node tree[600005];
  int root;
  int i;
  void insert(char* x) {
    int len = strlen(x);
    int pointer = root;
    for (int ii = 0; ii < len; ii++) {
      if (x[ii] == 'a') {
        if (tree[pointer].child[0] == 0) {
          tree[pointer].child[0] = i;
          tree[i].child[0] = 0;
          tree[i].child[1] = 0;
          tree[i].child[2] = 0;
          pointer = i++;
        } else {
          pointer = tree[pointer].child[0];
        }
      } else if (x[ii] == 'b') {
        if (tree[pointer].child[1] == 0) {
          tree[pointer].child[1] = i;
          tree[i].child[0] = 0;
          tree[i].child[1] = 0;
          tree[i].child[2] = 0;
          pointer = i++;
        } else {
          pointer = tree[pointer].child[1];
        }
      } else {
        if (tree[pointer].child[2] == 0) {
          tree[pointer].child[2] = i;
          tree[i].child[0] = 0;
          tree[i].child[1] = 0;
          tree[i].child[2] = 0;
          pointer = i++;
        } else {
          pointer = tree[pointer].child[2];
        }
      }
    }
    tree[pointer].is_end = 1;
  }
  zds() {
    root = 1;
    i = 2;
    tree[root].child[0] = 0;
    tree[root].child[1] = 0;
    tree[root].child[2] = 0;
    tree[root].is_end = 1;
  }
};
void dfs(char* x, zds* y, int pointer1, int pointer2, int tp, int* flag) {
  if (*flag == 0) {
    if (tp == 1) {
      if (x[pointer1] == 'a') {
        if (y->tree[pointer2].child[0] != 0) {
          dfs(x, y, pointer1 + 1, y->tree[pointer2].child[0], 1, flag);
        }
        if (y->tree[pointer2].child[1] != 0) {
          dfs(x, y, pointer1 + 1, y->tree[pointer2].child[1], 0, flag);
        }
        if (y->tree[pointer2].child[2] != 0) {
          dfs(x, y, pointer1 + 1, y->tree[pointer2].child[2], 0, flag);
        }
      } else if (x[pointer1] == 'b') {
        if (y->tree[pointer2].child[1] != 0) {
          dfs(x, y, pointer1 + 1, y->tree[pointer2].child[1], 1, flag);
        }
        if (y->tree[pointer2].child[0] != 0) {
          dfs(x, y, pointer1 + 1, y->tree[pointer2].child[0], 0, flag);
        }
        if (y->tree[pointer2].child[2] != 0) {
          dfs(x, y, pointer1 + 1, y->tree[pointer2].child[2], 0, flag);
        }
      } else {
        if (y->tree[pointer2].child[2] != 0) {
          dfs(x, y, pointer1 + 1, y->tree[pointer2].child[2], 1, flag);
        }
        if (y->tree[pointer2].child[0] != 0) {
          dfs(x, y, pointer1 + 1, y->tree[pointer2].child[0], 0, flag);
        }
        if (y->tree[pointer2].child[1] != 0) {
          dfs(x, y, pointer1 + 1, y->tree[pointer2].child[1], 0, flag);
        }
      }
      return;
    } else {
      int z = pointer2;
      int ii;
      for (ii = pointer1; ii < strlen(x); ii++) {
        if (x[ii] == 'a') {
          if (y->tree[pointer2].child[0] != 0) {
            pointer2 = y->tree[pointer2].child[0];
          } else {
            pointer2 = z;
            return;
          }
        } else if (x[ii] == 'b') {
          if (y->tree[pointer2].child[1] != 0) {
            pointer2 = y->tree[pointer2].child[1];
          } else {
            pointer2 = z;
            return;
          }
        } else {
          if (y->tree[pointer2].child[2] != 0) {
            pointer2 = y->tree[pointer2].child[2];
          } else {
            pointer2 = z;
            return;
          }
        }
      }
      if (y->tree[pointer2].is_end == 1 && tp == 0 && ii == strlen(x)) {
        *flag = 1;
      }
    }
  } else {
    return;
  }
}
int main() {
  int n, m;
  cin >> n >> m;
  zds* x = new zds();
  char xx[1000010];
  for (int i = 1; i <= n; i++) {
    scanf("%s", xx);
    x->insert(xx);
  }
  for (int i = 1; i <= m; i++) {
    scanf("%s", xx);
    int flag = 0;
    dfs(xx, x, 0, 1, 1, &flag);
    if (flag == 1) {
      cout << "YES" << endl;
      flag = 0;
    } else {
      cout << "NO" << endl;
    }
  }
}
