#include <bits/stdc++.h>
using namespace std;
void solve() {
  int n, m;
  cin >> n >> m;
  int oddc = 0, evenc = 0, oddk = 0, evenk = 0;
  for (int i = 0; i < n; i++) {
    int tmp;
    cin >> tmp;
    oddc += tmp % 2;
  }
  for (int i = 0; i < m; i++) {
    int tmp;
    cin >> tmp;
    oddk += tmp % 2;
  }
  cout << min(oddc, m - oddk) + min(n - oddc, oddk);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  solve();
  return 0;
}
