#include <bits/stdc++.h>
using namespace std;
int n, m;
set<string> a, b, c;
void solve() {
  cin >> n >> m;
  for (int i = 1; i <= n; i++) {
    string s;
    cin >> s;
    a.insert(s);
  }
  for (int i = 1; i <= m; i++) {
    string s;
    cin >> s;
    if (a.count(s)) c.insert(s);
    b.insert(s);
  }
  while (1) {
    if (a.empty()) {
      cout << "NO\n";
      return;
    }
    if (!c.empty()) {
      a.erase(*c.begin());
      b.erase(*c.begin());
      c.erase(c.begin());
    } else {
      if (b.count(*a.begin())) b.erase(*a.begin());
      a.erase(a.begin());
    }
    if (b.empty()) {
      cout << "YES\n";
      return;
    }
    if (!c.empty()) {
      a.erase(*c.begin());
      b.erase(*c.begin());
      c.erase(c.begin());
    } else {
      if (a.count(*b.begin())) a.erase(*b.begin());
      b.erase(b.begin());
    }
  }
}
int main() {
  int t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
