#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  int n, m;
  cin >> n >> m;
  int a, b;
  int cnt = 0, cnt1 = 0, acnt = 0, acnt1 = 0;
  for (int i = 1; i <= n; i++) {
    cin >> a;
    if (a % 2) cnt++;
  }
  cnt1 = n - cnt;
  for (int i = 1; i <= m; i++) {
    cin >> b;
    if (b % 2) acnt++;
  }
  acnt1 = m - acnt;
  cout << min(n, min(cnt, acnt1) + min(cnt1, acnt)) << endl;
  return 0;
}
