#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int odd_a = 0, even_a = 0, odd_b = 0, even_b = 0;
  int x;
  for (int i = 0; i < n; i++) {
    cin >> x;
    if (x % 2 == 0)
      even_a++;
    else
      odd_a++;
  }
  for (int i = 0; i < m; i++) {
    cin >> x;
    if (x % 2 == 0)
      even_b++;
    else
      odd_b++;
  }
  int xx = min(even_a, odd_b);
  int xx2 = min(even_b, odd_a);
  cout << xx + xx2 << endl;
  return 0;
}
