#include <bits/stdc++.h>
using namespace std;
int chest, key, *chests, *keys, sign[4] = {0};
int main() {
  cin >> chest >> key;
  chests = new int[chest], keys = new int[key];
  for (int c = 0; c < chest; c++) {
    cin >> chests[c];
    if (chests[c] % 2)
      sign[0]++;
    else
      sign[1]++;
  }
  for (int c = 0; c < key; c++) {
    cin >> keys[c];
    if (keys[c] % 2)
      sign[2]++;
    else
      sign[3]++;
  }
  cout << min(sign[0], sign[3]) + min(sign[2], sign[1]);
}
