#include <bits/stdc++.h>
using namespace std;
int main() {
  int chest, key, i, j, oddc, evenc, oddk, evenk, r1, r2, r;
  evenc = evenk = oddc = oddk = 0;
  cin >> chest >> key;
  for (i = 0; i < chest; i++) {
    cin >> j;
    if (j % 2 == 0) {
      evenc++;
    } else {
      oddc++;
    }
  }
  for (i = 0; i < key; i++) {
    cin >> j;
    if (j % 2 == 0) {
      evenk++;
    } else {
      oddk++;
    }
  }
  r1 = min(evenc, oddk);
  r2 = min(evenk, oddc);
  r = r1 + r2;
  cout << r << endl;
  return 0;
}
