#include <bits/stdc++.h>
using namespace std;
int chest, key, cInput, kInput, chestEven = 0, chestOdd = 0, keyEven = 0,
                                keyOdd = 0;
void Input() {
  cin >> chest >> key;
  for (int i = 0; i < chest; i++) {
    cin >> cInput;
    if ((1 & cInput)) chestOdd++;
  }
  chestEven = chest - chestOdd;
  for (int j = 0; j < key; j++) {
    cin >> kInput;
    if (!(1 & kInput)) keyEven++;
  }
  keyOdd = (key - keyEven);
}
void Solve() {
  cout << (min(keyEven, chestOdd) + min(keyOdd, chestEven)) << endl;
}
int main() {
  Input();
  Solve();
  return 0;
}
