#include <bits/stdc++.h>
using namespace std;
int main() {
  int odd_a = 0, odd_b = 0, even_a = 0, even_b = 0;
  int a, b, c;
  cin >> a >> b;
  for (int i = 0; i < a; i++) {
    cin >> c;
    c % 2 ? odd_a++ : even_a++;
  }
  for (int i = 0; i < b; i++) {
    cin >> c;
    c % 2 ? odd_b++ : even_b++;
  }
  int ans = 0;
  ans += min(odd_a, even_b);
  ans += min(even_a, odd_b);
  printf("%d", ans);
}
