#include <bits/stdc++.h>
using namespace std;
long min(long a, long b) {
  if (a <= b)
    return a;
  else
    return b;
}
int main() {
  int n, m;
  long odd_t = 0, even_t = 0, odd_k = 0, even_k = 0, a;
  cin >> n >> m;
  while (n--) {
    cin >> a;
    if (a % 2 == 0)
      even_t++;
    else
      odd_t++;
  }
  while (m--) {
    cin >> a;
    if (a % 2 == 0)
      even_k++;
    else
      odd_k++;
  }
  cout << min(odd_t, even_k) + min(odd_k, even_t);
  return 0;
}
