#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx2")
#pragma GCC optimize("Os")
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  string str, s = "1", s1;
  long long n, x, y, b = 0, k = 1, i, j = 0, t = 1, sum = 0, c = 0, d = 0, m,
                     a = 0, o1 = 0, e1 = 0, o2 = 0, e2 = 0;
  cin >> n >> m;
  for (i = 0; i < n; i++) {
    cin >> a;
    if (a & 1)
      ++o1;
    else
      ++e1;
  }
  for (i = 0; i < m; i++) {
    cin >> a;
    if (a & 1)
      ++o2;
    else
      ++e2;
  }
  cout << min(o1, e2) + min(e1, o2);
  return 0;
}
