#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m;
  cin >> n >> m;
  int ch = 0, nch = 0;
  int x;
  int b;
  if (n >= m) {
    b = m;
  } else {
    b = n;
  }
  for (int i = 0; i < n; i++) {
    cin >> x;
    if (x % 2 == 0) {
      ch++;
    } else {
      nch++;
    }
  }
  for (int i = 0; i < m; i++) {
    cin >> x;
    if (x % 2 == 0) {
      ch++;
    } else {
      nch++;
    }
  }
  if (nch > ch) {
    if (ch < b) {
      cout << ch << endl;
    } else {
      cout << b << endl;
    }
  } else {
    if (nch < b) {
      cout << nch << endl;
    } else {
      cout << b << endl;
    }
  }
  return 0;
}
