#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 7;
int a[maxn], b[maxn];
int main() {
  int n, m;
  while (cin >> n >> m) {
    int o1 = 0, o2 = 0, e1 = 0, e2 = 0;
    for (int i = 1; i <= n; i++) {
      cin >> a[i];
      if (a[i] % 2 == 0)
        o1++;
      else
        e1++;
    }
    for (int i = 1; i <= m; i++) {
      cin >> b[i];
      if (b[i] % 2 == 0)
        o2++;
      else
        e2++;
    }
    cout << min(o1, e2) + min(o2, e1) << endl;
  }
  return 0;
}
