#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, x, y, i, count = 0, cnt = 0;
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    cin >> x;
    if (x % 2 != 0) {
      cnt++;
    }
  }
  for (i = 0; i < m; i++) {
    cin >> y;
    if (y % 2 != 0) {
      count++;
    }
  }
  int evenx = n - cnt;
  int eveny = m - count;
  int ans = (min(cnt, eveny) + min(evenx, count));
  cout << ans << endl;
  return 0;
}
