#include <bits/stdc++.h>
using namespace std;
int main() {
  int m, n, x;
  cin >> m >> n;
  int s1 = 0, s2 = 0;
  for (int i = 1; i <= m; i++) {
    cin >> x;
    if (x % 2 == 0) s1++;
  }
  for (int i = 1; i <= n; i++) {
    cin >> x;
    if (x % 2 == 0) s2++;
  }
  int sum = min(s1, n - s2) + min(m - s1, s2);
  cout << sum << endl;
  return 0;
}
