#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
int n, m, a[MAXN], b[MAXN];
int cnta, cntb;
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    cnta += (a[i] & 1);
  }
  for (int i = 1; i <= m; i++) {
    scanf("%d", &b[i]);
    cntb += (b[i] & 1);
  }
  int ans = min(cnta, m - cntb) + min(cntb, n - cnta);
  printf("%d", ans);
  return 0;
}
