#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, i, j, eco = 0, odco = 0, econ = 0, oddcon = 0, a, b, ans = 0;
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    cin >> a;
    if (a % 2 != 0)
      odco++;
    else
      eco++;
  }
  for (j = 0; j < m; j++) {
    cin >> b;
    if (b % 2 != 0)
      oddcon++;
    else
      econ++;
  }
  ans = min(odco, econ) + min(eco, oddcon);
  cout << ans << endl;
}
