#include <bits/stdc++.h>
using namespace std;
int main() {
  int m, n;
  int key[2] = {0, 0}, chest[2] = {0, 0};
  scanf("%i%i", &n, &m);
  for (int i = 0; i < n; i++) {
    int k;
    scanf("%i", &k);
    chest[k % 2]++;
  }
  for (int i = 0; i < m; i++) {
    int k;
    scanf("%i", &k);
    key[k % 2]++;
  }
  int ans = 0;
  ans += std::min(key[0], chest[1]);
  ans += std::min(key[1], chest[0]);
  printf("%i\n", ans);
}
