#include <bits/stdc++.h>
using namespace std;
bool prime(long long int n) {
  for (long long int i = 2; i * i <= n; i++) {
    if (n % i == 0) return false;
  }
  return true;
}
int main() {
  long long int n, m, c1 = 0, c2 = 0, k1 = 0, k2 = 0;
  cin >> n >> m;
  vector<long long int> a(n);
  vector<long long int> b(m);
  for (long long int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] % 2 == 1)
      c1++;
    else
      c2++;
  }
  for (long long int i = 0; i < m; i++) {
    cin >> b[i];
    if (b[i] % 2 == 1)
      k1++;
    else
      k2++;
  }
  cout << min(c1, k2) + min(c2, k1);
}
