#include <bits/stdc++.h>
#define N 100000
using namespace std;
int n,m,a[N+2],b[N+2],d;
int main()
{
    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+n+1,greater<int>());
    sort(b+1,b+n+1);
    for(int i=1;i<=n;i++)
        for(int j=1;j<=m;j++)
            if(a[i]>0&&b[j]>0&&a[i]>b[j])
            {
                d++;
                a[i]=0;b[j]=0;
            }
    cout<<d;
    return 0;
}
