#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, OddChest = 0, EvenChest = 0, OddKey = 0, EvenKey = 0;
  cin >> n >> m;
  vector<long long> v1, v2;
  long long q;
  for (int i = 0; i < n; i++) {
    cin >> q;
    v1.push_back(q);
    if (q % 2 == 0)
      EvenChest++;
    else
      OddChest++;
  }
  for (int i = 0; i < m; i++) {
    cin >> q;
    v2.push_back(q);
    if (q % 2 == 0)
      EvenKey++;
    else
      OddKey++;
  }
  cout << min(OddChest, EvenKey) + min(EvenChest, OddKey) << '\n';
  return 0;
}
