#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, a = 0, b = 0;
  int aj = 0, ao = 0, bj = 0, bo = 0;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> a;
    if (a % 2 == 1)
      aj++;
    else
      ao++;
  }
  for (int i = 0; i < m; i++) {
    cin >> b;
    if (b % 2 == 1)
      bj++;
    else
      bo++;
  }
  int sum = 0;
  if (aj > bo)
    sum = sum + bo;
  else
    sum = sum + aj;
  if (bj > ao)
    sum = sum + ao;
  else
    sum = sum + bj;
  cout << sum << endl;
  return 0;
}
