#include <bits/stdc++.h>
using namespace std;
int a[1000005], b[1000005];
int c1e, c2e, c1o, c2o;
int main() {
  ios_base::sync_with_stdio(false);
  cout.tie(0);
  cin.tie(0);
  int i, j, k, l, m, n, t;
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] & 1) {
      c1o++;
    } else {
      c1e++;
    }
  }
  for (i = 0; i < m; i++) {
    cin >> b[i];
    if (b[i] & 1) {
      c2o++;
    } else {
      c2e++;
    }
  }
  cout << min(c1o, c2e) + min(c2o, c1e) << endl;
}
