#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e9;
const long long N = 5e2 + 1;
const long long mod = 1e9 + 7;
const long double eps = 1E-7;
long long int n, cnt1, ans1, m, cnt, ans, a, b;
pair<int, int> p[N], P[N];
string s;
vector<int> v, V;
int arr[100000];
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) {
    cin >> a;
    if (a % 2 == 1)
      cnt++;
    else
      ans++;
  }
  for (int i = 0; i < m; i++) {
    cin >> b;
    if (b % 2 == 1)
      cnt1++;
    else
      ans1++;
  }
  cout << min(cnt, ans1) + min(cnt1, ans);
}
