#include <bits/stdc++.h>
using namespace std;
struct TrieNode {
  TrieNode *children[3] = {nullptr, nullptr, nullptr};
  bool isLeaf = false;
  void insert(string &input, int index) {
    if (input.size() == index) {
      isLeaf = true;
      return;
    }
    char curr = input[index];
    if (children[curr - 'a'] == nullptr) {
      children[curr - 'a'] = new TrieNode;
    }
    children[curr - 'a']->insert(input, index + 1);
  }
  bool query(string &input, int index, bool badLeft) {
    if (input.size() == index) {
      return isLeaf && !badLeft;
    }
    char curr = input[index];
    if (badLeft) {
      for (int i = 0; i < 3; i++) {
        if (i != curr - 'a' && children[i] != nullptr) {
          if (children[i]->query(input, index + 1, false)) return true;
        }
      }
    }
    if (children[curr - 'a'] != nullptr &&
        children[curr - 'a']->query(input, index + 1, badLeft))
      return true;
    return false;
  }
};
int main() {
  long long n, m;
  cin >> n >> m;
  cin.ignore();
  string input;
  TrieNode *trie = new TrieNode;
  for (int i = 0; i < n; i++) {
    cin >> input;
    trie->insert(input, 0);
  }
  for (int i = 0; i < m; i++) {
    cin >> input;
    if (trie->query(input, 0, true))
      cout << "YES" << endl;
    else
      cout << "NO" << endl;
  }
  return 0;
}
