#include <bits/stdc++.h>
using namespace std;
int a[3], b[3];
int main() {
  int n, m;
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) {
    int c;
    cin >> c;
    a[c % 2]++;
  }
  for (int j = 1; j <= m; ++j) {
    int c;
    cin >> c;
    b[c % 2]++;
  }
  cout << min(a[1], b[0]) + min(b[1], a[0]) << '\n';
  return 0;
}
