#include <bits/stdc++.h>
#define N 10000007
using namespace std;
long long n,m,a[N],b[N],res=0,dem=0,inra;
int main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);cout.tie(0);
    freopen("CAU2.INP","r",stdin);
    freopen("CAU2.OUT","w",stdout);
    cin>>n>>m;
    for(int i=1;i<=n;i++){
        cin>>a[i];
    }
    for(int i=1;i<=m;i++){
        cin>>b[i];
    }
    sort(a+1,a+1+n,greater<long long>());
    sort(b+1,b+1+m);
    for(int i=1;i<=min(m,n);i++){
        if(a[i]>b[i]){
            res++;
        }
    }
    sort(b+1,b+1+m,greater<long long>());
    for(int i=1;i<=min(m,n);i++){
        if(a[i]>b[i]){
            dem++;
        }
    }
    inra=max(dem,res);
    cout<<inra;
    return 0;
}
