#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  long long n, m;
  cin >> n >> m;
  vector<long long> a(n), b(m);
  for (long long i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (long long i = 0; i < m; i++) {
    cin >> b[i];
  }
  long long c0 = 0, c1 = 0, k0 = 0, k1 = 0;
  for (long long i = 0; i < n; i++) {
    if (a[i] % 2 == 0)
      c0++;
    else
      c1++;
  }
  for (long long i = 0; i < m; i++) {
    if (b[i] % 2 == 0)
      k0++;
    else
      k1++;
  }
  long long cnt = min(c0, k1) + min(c1, k0);
  cout << cnt << endl;
}
