#include <bits/stdc++.h>
int main() {
  int n, m;
  int a, b;
  int min1, min2;
  int s1 = 0, s2 = 0, k1 = 0, k2 = 0;
  scanf("%d%d", &n, &m);
  while (n--) {
    scanf("%d", &a);
    if (a % 2 == 0)
      s1++;
    else
      s2++;
  }
  while (m--) {
    scanf("%d", &b);
    if (b % 2 == 0)
      k1++;
    else
      k2++;
  }
  if (s1 > k2)
    min1 = k2;
  else
    min1 = s1;
  if (k1 > s2)
    min2 = s2;
  else
    min2 = k1;
  printf("%d", min1 + min2);
}
