#include <bits/stdc++.h>
using namespace std;
long long in() {
  long long a;
  scanf("%lld", &a);
  return a;
}
double din() {
  double a;
  scanf("%lf", &a);
  return a;
}
long long bigmod(long long b, long long p, long long md) {
  if (p == 0) return 1;
  if (p % 2 == 1) {
    return ((b % md) * bigmod(b, p - 1, md)) % md;
  } else {
    long long y = bigmod(b, p / 2, md);
    return (y * y) % md;
  }
}
long long gcd(long long a, long long b) {
  if (b == 0)
    return a;
  else
    return gcd(b, a % b);
}
long long getRandom(long long a, long long b) {
  long long ret = (long long)rand() * (long long)rand();
  ret %= (b - a + 1);
  ret += a;
  return ret;
}
int main() {
  int n = in(), m = in();
  int a = 0, b = 0, c = 0, d = 0;
  for (int i = 0; i < n; i++) {
    int x = in();
    if (x & 1)
      a++;
    else
      b++;
  }
  for (int i = 0; i < m; i++) {
    int x = in();
    if (x & 1)
      c++;
    else
      d++;
  }
  printf("%lld\n", (long long)min(a, d) + min(b, c));
}
