#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, x, y, i, j, a1 = 0, a2 = 0, b1 = 0, b2 = 0;
  cin >> n >> m;
  int a[n], b[m];
  for (i = 0; i < n; i++) cin >> a[i];
  for (i = 0; i < m; i++) cin >> b[i];
  for (i = 0; i < n; i++) {
    if (a[i] % 2 == 1)
      a1++;
    else
      a2++;
  }
  for (i = 0; i < m; i++) {
    if (b[i] % 2 == 1)
      b1++;
    else
      b2++;
  }
  x = a1;
  if (b2 < x) x = b2;
  y = a2;
  if (b1 < y) y = b1;
  cout << x + y;
}
