#include <bits/stdc++.h>
using namespace std;
void FI() {}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  FI();
  int n, m, a, x = 0, y = 0, x1 = 0, y1 = 0;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> a;
    if (a % 2 == 1)
      x++;
    else
      y++;
  }
  for (int i = 0; i < m; i++) {
    cin >> a;
    if (a % 2 == 1)
      x1++;
    else
      y1++;
  }
  cout << min(x, y1) + min(x1, y) << endl;
  return 0;
}
