#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, x;
  cin >> n >> m;
  long long oa = 0, ea = 0;
  long long ob = 0, eb = 0;
  for (long long i = 0; i < n; i++) {
    cin >> x;
    if (x % 2)
      oa++;
    else
      ea++;
  }
  for (long long i = 0; i < m; i++) {
    cin >> x;
    if (x % 2)
      ob++;
    else
      eb++;
  }
  cout << min(oa, eb) + min(ea, ob);
}
