#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int p;
  int j1 = 0, o1 = 0, j2 = 0, o2 = 0;
  for (int i = 0; i < n; i++) {
    cin >> p;
    if (p & 1)
      j1++;
    else
      o1++;
  }
  for (int i = 0; i < m; i++) {
    cin >> p;
    if (p & 1)
      j2++;
    else
      o2++;
  }
  int sum = min(j1, o2) + min(j2, o1);
  cout << sum << endl;
}
