#include <bits/stdc++.h>
using namespace std;
int n, m, t1, t2, t3, t4;
int main() {
  scanf("%d%d", &n, &m);
  for (int x, i = 1; i <= n; i++) {
    scanf("%d", &x);
    if (x & 1)
      t1++;
    else
      t2++;
  }
  for (int x, i = 1; i <= m; i++) {
    scanf("%d", &x);
    if (x & 1)
      t3++;
    else
      t4++;
  }
  cout << min(t1, t4) + min(t2, t3);
}
