#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int A[n], B[m], O_C = 0, E_C = 0, E_K = 0, O_K = 0;
  for (int i = 0; i < n; i++) {
    cin >> A[i];
    if (A[i] % 2 == 0)
      E_C++;
    else
      O_C++;
  }
  for (int j = 0; j < m; j++) {
    cin >> B[j];
    if (B[j] % 2 == 0)
      E_K++;
    else
      O_K++;
  }
  cout << (min(O_K, E_C) + min(E_K, O_C));
}
