#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int na = 0, nb = 0, ma = 0, mb = 0;
  for (int i = 1; i <= n; i++) {
    int a;
    scanf("%d", &a);
    if (a % 2)
      na++;
    else
      nb++;
  }
  for (int i = 1; i <= m; i++) {
    int a;
    scanf("%d", &a);
    if (a % 2)
      ma++;
    else
      mb++;
  }
  cout << min(na, mb) + min(nb, ma);
}
