#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, cnt1 = 0, cnt2 = 0, cnt3 = 0, cnt4 = 0, x;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> x;
    if (x & 1)
      cnt1++;
    else
      cnt2++;
  }
  for (int i = 0; i < m; i++) {
    cin >> x;
    if (x & 1)
      cnt3++;
    else
      cnt4++;
  }
  cout << min(cnt1, cnt4) + min(cnt2, cnt3) << endl;
  return 0;
}
