#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int oddc = 0;
  int evenc = 0;
  int oddk = 0;
  int evenk = 0;
  int a;
  int b;
  for (int i = 1; i <= n; i++) {
    cin >> a;
    if (a % 2 == 0)
      evenc++;
    else
      oddc++;
    a = 0;
  }
  for (int i = 1; i <= m; i++) {
    cin >> b;
    if (b % 2 == 0)
      evenk++;
    else
      oddk++;
    b = 0;
  }
  int ans = min(oddc, evenk) + min(oddk, evenc);
  cout << ans << endl;
}
