#include <bits/stdc++.h>
using namespace std;
int main() {
  int c, k;
  cin >> c >> k;
  int arr1[c + 1], c1 = 0, c2 = 0;
  for (int i = 0; i < c; i++) {
    cin >> arr1[i];
    if (arr1[i] % 2 == 0)
      c1++;
    else
      c2++;
  }
  int arr2[k + 1], k1 = 0, k2 = 0;
  for (int i = 0; i < k; i++) {
    cin >> arr2[i];
    if (arr2[i] % 2 == 0)
      k1++;
    else
      k2++;
  }
  int s = c1 + k1;
  int g = c2 + k2;
  int f = min(s, g);
  int h = min(c, k);
  int t = min(f, h);
  cout << t << endl;
  return 0;
}
