#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, o1 = 0, o2 = 0, e1 = 0, e2 = 0, total = 0;
  cin >> n >> m;
  int a[n];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] % 2 == 0)
      e1++;
    else
      o1++;
  }
  int b[m];
  for (int i = 0; i < m; i++) {
    cin >> b[i];
    if (b[i] % 2 == 0)
      e2++;
    else
      o2++;
  }
  total = min(o1, e2) + min(o2, e1);
  cout << total << endl;
  return 0;
}
