#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m;
  cin >> n >> m;
  long long arr[n];
  long long brr[m];
  long long a = 0, b = 0, c = 0, d = 0;
  long long e, f;
  for (long long i = 0; i < n; i++) {
    cin >> arr[i];
    if (arr[i] % 2 == 0)
      a++;
    else
      b++;
  }
  for (long long i = 0; i < m; i++) {
    cin >> brr[i];
    if (brr[i] % 2 == 0)
      c++;
    else
      d++;
  }
  e = min(a, d);
  f = min(b, c);
  e += f;
  cout << min(e, n);
}
