#include <bits/stdc++.h>
using namespace std;
int n_keys, n_chests;
int odd_keys, even_keys, odd_chests, even_chests;
int main() {
  cin >> n_keys >> n_chests;
  for (int i = 0; i < n_keys; i++) {
    int x;
    cin >> x;
    if (x % 2 == 0)
      even_keys++;
    else
      odd_keys++;
  }
  for (int i = 0; i < n_chests; i++) {
    int x;
    cin >> x;
    if (x % 2 == 0)
      even_chests++;
    else
      odd_chests++;
  }
  cout << min(even_chests, odd_keys) + min(odd_chests, even_keys) << '\n';
}
