#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  ;
  long long n, m, i = 0, k = 0, j = 0, l = 1000000000000000000,
                  r = 1000000000000000000, q = 1000000000000000000, ans = 0,
                  x = 1, y = 0;
  cin >> n >> m;
  long long a[n + 1], b[m + 1];
  for (i = (1); i <= (n); i++) cin >> a[i], a[i] %= 2;
  for (i = (1); i <= (m); i++) cin >> b[i], b[i] %= 2;
  sort(a + 1, a + n + 1);
  sort(b + 1, b + m + 1);
  for (i = (1); i <= (n); i++)
    if (a[i]) j++;
  k = n - j;
  for (i = (1); i <= (m); i++)
    if (b[i]) y++;
  x = m - y;
  ans = min(y, k) + min(x, j);
  cout << ans;
}
