#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b, arr1[100000], arr2[100000];
  cin >> a >> b;
  long long sum1 = 0, sum2 = 0;
  for (int i = 0; i < a; i++) {
    cin >> arr1[i];
    if (arr1[i] & 1)
      sum1++;
    else
      sum2++;
  }
  long long sum3 = 0, sum4 = 0;
  for (int i = 0; i < b; i++) {
    cin >> arr2[i];
    if (arr2[i] & 1)
      sum3++;
    else
      sum4++;
  }
  cout << min(sum1, sum4) + min(sum2, sum3) << "\n";
  return 0;
}
