#include <bits/stdc++.h>
using namespace std;
int main() {
  ios ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  if (fopen("main.in", "r"))
    freopen("main.in", "r", stdin);
  else if (fopen("something"
                 ".inp",
                 "r"))
    freopen(
        "something"
        ".inp",
        "r", stdin),
        freopen(
            "something"
            ".out",
            "w", stdout);
  int n, m;
  cin >> n >> m;
  int cnt1 = 0, cnt2 = 0, cnt3 = 0, cnt4 = 0;
  for (int i = 1; i <= n; i++) {
    int a;
    cin >> a;
    cnt1 += (a % 2 == 1);
    cnt2 += (a % 2 == 0);
  }
  for (int i = 1; i <= m; i++) {
    int a;
    cin >> a;
    cnt3 += (a % 2 == 1);
    cnt4 += (a % 2 == 0);
  }
  cout << min(cnt1, cnt4) + min(cnt2, cnt3) << '\n';
  return 0;
}
