#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int a[n], b[m], ae[n], ao[n], be[m], bo[m];
  int x = 0, y = 0, c = 0, d = 0, k = 0, j = 0;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    if (a[i] % 2 == 0)
      x++;
    else
      y++;
  }
  for (int i = 0; i < m; i++) {
    cin >> b[i];
    if (b[i] % 2 == 0)
      c++;
    else
      d++;
  }
  if (x < d)
    k = x;
  else
    k = d;
  if (c < y)
    j = c;
  else
    j = y;
  cout << k + j;
}
