#include <bits/stdc++.h>
int main(void) {
  int i, n, m, chest_odd = 0, chest_even = 0, key_even = 0, key_odd = 0, res,
               res_1, res_2;
  long int inp;
  scanf("%d%d", &n, &m);
  for (i = 0; i < n; ++i) {
    scanf("%ld", &inp);
    if (inp % 2) {
      ++chest_odd;
    } else {
      ++chest_even;
    }
  }
  for (i = 0; i < m; ++i) {
    scanf("%ld", &inp);
    if (inp % 2) {
      ++key_odd;
    } else {
      ++key_even;
    }
  }
  if (chest_odd < key_even) {
    res_1 = chest_odd;
  } else {
    res_1 = key_even;
  }
  if (chest_even < key_odd) {
    res_2 = chest_even;
  } else {
    res_2 = key_odd;
  }
  res = res_1 + res_2;
  printf("%d", res);
  return 0;
}
