#include <bits/stdc++.h>
using namespace std;
int main() {
  int a, b, s[110000], r[110000], i, j, k, c, m, w = 0, x = 0, y = 0, z = 0, o,
                                                 p;
  cin >> a >> b;
  for (i = 1; i <= a; i++) {
    cin >> s[i];
  }
  for (j = 1; j <= b; j++) {
    cin >> r[j];
  }
  for (k = 1; k <= a; k++) {
    if (s[k] % 2 == 0) {
      w++;
    }
    if (s[k] % 2 == 1) {
      y++;
    }
  }
  for (c = 1; c <= b; c++) {
    if (r[c] % 2 == 1) {
      x++;
    }
    if (r[c] % 2 == 0) {
      z++;
    }
  }
  if (w >= x) {
    o = x;
  } else
    o = w;
  if (y >= z) {
    p = z;
  } else
    p = y;
  cout << o + p;
  return 0;
}
