#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m, c;
  cin >> n >> m;
  int i, j, s = 0;
  long long a[n], b[m];
  for (i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (i = 0; i < m; i++) {
    cin >> b[i];
  }
  int x = 0, y = 0, x1 = 0, y1 = 0;
  for (i = 0; i < n; i++) {
    if (a[i] % 2 == 0)
      x++;
    else
      y++;
  }
  for (i = 0; i < m; i++) {
    if (b[i] % 2 == 0)
      x1++;
    else
      y1++;
  }
  int k;
  k = min(x, y1) + min(x1, y);
  cout << k << endl;
}
