#include <bits/stdc++.h>
int main() {
  int n, m;
  std::cin >> n >> m;
  int no, ne, mo, me;
  no = ne = mo = me = 0;
  for (int i = 1; i <= n; ++i) {
    int tmp;
    std::cin >> tmp;
    if (tmp & 1)
      no++;
    else
      ne++;
  }
  for (int i = 1; i <= m; ++i) {
    int tmp;
    std::cin >> tmp;
    if (tmp & 1)
      mo++;
    else
      me++;
  }
  long long ret = ((no) < (me) ? (no) : (me)) + ((ne) < (mo) ? (ne) : (mo));
  std::cout << ret;
}
