#include <bits/stdc++.h>
const long long INF = 9223372036854775807;
const long long MOD = 1e9 + 7;
long long power(long long x, unsigned long long y, long long p) {
  long long res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
const int N = 1e9;
int main() {
  int n, m;
  scanf("%d", &n);
  scanf("%d", &m);
  int o = 0, e = 0;
  for (int t = 0; t < n; t++) {
    int tmp;
    scanf("%d", &tmp);
    if (tmp % 2)
      o++;
    else
      e++;
  }
  do {
  } while (false);
  ;
  do {
  } while (false);
  ;
  int ok = 0, ek = 0;
  for (int t = 0; t < m; t++) {
    int tmp;
    scanf("%d", &tmp);
    if (tmp % 2)
      ok++;
    else
      ek++;
  }
  do {
  } while (false);
  ;
  do {
  } while (false);
  ;
  int ans = (ok > e ? e : ok) + (ek > o ? o : ek);
  std::cout << ans;
  return 0;
}
