#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int n, m, gn1 = 0, gj1 = 0, gn2 = 0, gj2 = 0;
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    if (x % 2 == 0)
      gn1++;
    else
      gj1++;
  }
  for (int i = 0; i < m; i++) {
    int x;
    cin >> x;
    if (x % 2 == 0)
      gn2++;
    else
      gj2++;
  }
  cout << min(gj1, gn2) + min(gj2, gn1) << "\n";
}
