#include <bits/stdc++.h>
int main() {
  int i, j, k, a = 0, b = 0, c = 0, d = 0, n, m, sum = 0;
  int arr[100000], str[100000];
  scanf("%d%d", &n, &m);
  for (i = 0; i < n; i++) {
    scanf("%d", &arr[i]);
    if (arr[i] % 2 == 0)
      a++;
    else
      b++;
  }
  for (i = 0; i < m; i++) {
    scanf("%d", &str[i]);
    if (str[i] % 2 == 0)
      c++;
    else
      d++;
  }
  if (a > d)
    sum = sum + d;
  else
    sum = sum + a;
  if (b < c)
    sum = sum + b;
  else
    sum = sum + c;
  printf("%d", sum);
}
