#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  vector<int> e, o;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    if (x % 2 == 0) {
      e.push_back(x);
    } else {
      o.push_back(x);
    }
  }
  vector<int> ko, ke;
  for (int i = 0; i < m; i++) {
    int x;
    cin >> x;
    if (x % 2 == 0) {
      ke.push_back(x);
    } else {
      ko.push_back(x);
    }
  }
  cout << min(e.size(), ko.size()) + min(o.size(), ke.size()) << endl;
  return 0;
}
