#include <bits/stdc++.h>
using namespace std;
int n, m;
int main() {
  cin >> n >> m;
  int a[100001] = {
      0,
  };
  int b[100001] = {
      0,
  };
  int num;
  int c0 = 0;
  int c1 = 0;
  int k0 = 0;
  int k1 = 0;
  for (int i = 0; i < n; i++) {
    cin >> num;
    if (num % 2 == 0)
      c0++;
    else
      c1++;
  }
  for (int i = 0; i < m; i++) {
    cin >> num;
    if (num % 2 == 0)
      k0++;
    else
      k1++;
  }
  int ans = 0;
  ans += min(c0, k1) + min(c1, k0);
  cout << ans;
}
