#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, m, ctrO = 0, ctrOO = 0, temp, ans;
  cin >> n >> m;
  for (int i = 0; i < n; ++i) {
    cin >> temp;
    if (temp % 2 == 1) ++ctrO;
  }
  for (int i = 0; i < m; ++i) {
    cin >> temp;
    if (temp % 2 == 1) ++ctrOO;
  }
  ans = min(ctrO, m - ctrOO) + min(ctrOO, n - ctrO);
  cout << ans << endl;
}
