#include <bits/stdc++.h>
using namespace std;
long long int INF = 10000000000;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, m;
  cin >> n >> m;
  long long int chestOdd = 0, chestEven = 0;
  long long int i;
  for (i = 0; i < n; i++) {
    long long int temp;
    cin >> temp;
    if (temp % 2 == 0) {
      chestEven++;
    } else {
      chestOdd++;
    }
  }
  long long int keyOdd = 0, keyEven = 0;
  for (i = 0; i < m; i++) {
    long long int temp;
    cin >> temp;
    if (temp % 2 == 0) {
      keyEven++;
    } else {
      keyOdd++;
    }
  }
  long long int ans = 0;
  ans = min(keyEven, chestOdd);
  ans += min(keyOdd, chestEven);
  cout << ans << endl;
  return 0;
}
