#include <bits/stdc++.h>
using namespace std;
inline void FAST_IO() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
}
int main() {
  FAST_IO();
  int n, m;
  cin >> n >> m;
  pair<int, int> ac{0, 0}, bc{0, 0};
  for (int i = 0; i < n; ++i) {
    int a;
    cin >> a;
    if (a % 2)
      ac.first++;
    else
      ac.second++;
  }
  for (int i = 0; i < m; ++i) {
    int a;
    cin >> a;
    if (a % 2)
      bc.first++;
    else
      bc.second++;
  }
  cout << min(ac.first, bc.second) + min(ac.second, bc.first) << endl;
  return 0;
}
