#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m, i, t = 0, p = 0, e, ev, toteven, totodd, min1;
  cin >> n >> m;
  long long int a[n], b[m];
  for (i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] % 2 != 0) {
      t++;
    }
  }
  e = n - t;
  for (i = 0; i < m; i++) {
    cin >> b[i];
    if (b[i] % 2 != 0) {
      p++;
    }
  }
  min1 = min(n, m);
  ev = m - p;
  toteven = e + ev;
  totodd = t + p;
  if (totodd >= toteven) {
    if (toteven <= min1) {
      cout << toteven << endl;
      return 0;
    } else {
      cout << min1 << endl;
      return 0;
    }
  } else if (totodd == 0) {
    cout << 0 << endl;
    return 0;
  } else {
    if (totodd <= min1) {
      cout << totodd << endl;
      return 0;
    } else {
      cout << min1 << endl;
      return 0;
    }
  }
  return 0;
}
