#include <bits/stdc++.h>
void read(int &x) {
  int t = 0;
  char c = getchar();
  while (c < '0' || c > '9') c = getchar();
  while ('0' <= c && c <= '9') {
    t = t * 10 + c - '0';
    c = getchar();
  }
  x = t;
  return;
}
int cnt[2][2], n, m, x;
int main() {
  read(n);
  read(m);
  for (int i = 1; i <= n; i++) read(x), cnt[0][x & 1]++;
  for (int i = 1; i <= m; i++) read(x), cnt[1][x & 1]++;
  printf("%d\n",
         std::min(cnt[0][0], cnt[1][1]) + std::min(cnt[0][1], cnt[1][0]));
  return 0;
}
