#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m, even = 0, odd = 0, e = 0, o = 0;
  cin >> n >> m;
  vector<long long int> a, b;
  for (int i = 0; i < n; i++) {
    long long int x;
    cin >> x;
    a.push_back(x);
    if (x % 2 == 0) {
      e++;
    } else {
      o++;
    }
  }
  for (int i = 0; i < m; i++) {
    long long int x;
    cin >> x;
    b.push_back(x);
    if (x % 2 == 0) {
      even++;
    } else {
      odd++;
    }
  }
  long long int EVEN = 0, ODD = 0;
  EVEN = min(e, odd);
  ODD = min(even, o);
  cout << EVEN + ODD << endl;
  return 0;
}
