#define _CRT_SECURE_NO_WARNINGS
#define _SILENCE_CXX17_C_HEADER_DEPRECATION_WARNING
#include <bits/stdc++.h>
using namespace std;
int cnt[4];
int main()
{
    int n, m, x;
    scanf("%d%d", &n, &m);
    for (int i = 0; i < n; i++) scanf("%d", &x), cnt[x & 1]++;
    for (int i = 0; i < m; i++) scanf("%d", &x), cnt[(x & 1) | 2]++;
    printf("%d", min(cnt[0], cnt[3]) + min(cnt[1], cnt[2]));
    return 0;
}
