#include <bits/stdc++.h>
using namespace std;
int a[100007], b[100007];
int main() {
  int n, m;
  cin >> n >> m;
  int odda = 0, evena = 0, oddb = 0, evenb = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] & 1)
      odda++;
    else
      evena++;
  }
  for (int i = 0; i < m; i++) {
    cin >> b[i];
    if (b[i] & 1)
      oddb++;
    else
      evenb++;
  }
  cout << min(odda, evenb) + min(oddb, evena) << endl;
}
