#include <bits/stdc++.h>
using namespace std;
int banyakchest, banyakkey, chest[120120], key[120120], oddkey, evenkey,
    oddchest, evenchest;
int main() {
  cin >> banyakchest >> banyakkey;
  for (int i = 1; i <= banyakchest; i++) {
    cin >> chest[i];
    if (chest[i] % 2 == 0) {
      evenchest++;
    } else {
      oddchest++;
    }
  }
  for (int i = 1; i <= banyakkey; i++) {
    cin >> key[i];
    if (key[i] % 2 == 0) {
      evenkey++;
    } else {
      oddkey++;
    }
  }
  cout << min(oddchest, evenkey) + min(evenchest, oddkey) << endl;
}
