#include <bits/stdc++.h>
using namespace std;
int arr[2];
int err[2];
int a, b, c;
int mn1, mn2, ans = 0;
int main() {
  cin >> a >> b;
  for (int i = 1; i <= a; i++) {
    cin >> c;
    arr[c % 2]++;
  }
  for (int i = 1; i <= b; i++) {
    cin >> c;
    err[c % 2]++;
  }
  mn1 = min(arr[0], err[1]);
  mn2 = min(arr[1], err[0]);
  cout << mn1 + mn2;
}
