#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int x;
  int tE = 0, tO = 0, kE = 0, kO = 0;
  for (int i = 0; i < n; i++) {
    cin >> x;
    if (x % 2 == 0)
      tE++;
    else
      tO++;
  }
  for (int i = 0; i < m; i++) {
    cin >> x;
    if (x % 2 == 0)
      kE++;
    else
      kO++;
  }
  cout << (min(tE, kO) + min(kE, tO));
  return 0;
}
