#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int n, m;
  cin >> n >> m;
  vector<int> a(n);
  int q = 0, w = 0;
  int e = 0, r = 0;
  for (int i = 0; i < a.size(); i++) {
    cin >> a[i];
    if (a[i] % 2 == 0)
      q++;
    else
      e++;
  }
  vector<int> b(m);
  for (int i = 0; i < b.size(); i++) {
    cin >> b[i];
    if (b[i] % 2 == 0)
      w++;
    else
      r++;
  }
  cout << min(q, r) + min(e, w);
  return 0;
}
