#include <bits/stdc++.h>
#define ll long long
using namespace std;
ll n,m;
ll nhiphan(vector<ll>a,ll k){
    ll l = 0,r = a.size()-1;
    ll kq = -1;
    while(l <= r){
        ll mid = (r+l)/2;
        if(a[mid] < k){
            kq = mid;
            l  = mid+1;
        }else{
            r = mid-1;
        }
    }
    return kq;
}
ll kq = 0;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    freopen("CAU2.INP","r",stdin);
    freopen("CAU2.OUT","w",stdout);
    cin >> n>>m;
    vector<ll>a(n);
    vector<ll>b(m);
    for(int i = 0;i < n;i++){
        cin >> a[i];
    }
    for(int i = 0;i < m;i++){
        cin >> b[i];
    }
    sort(a.rbegin(),a.rend());
    sort(b.begin(),b.end());
    for(int i = 0;i < n;i++){
        ll k = nhiphan(b,a[i]);
        if(k!=-1){
            kq++;
            b[k] = LLONG_MAX;
        }
    }
    cout << kq;
    return 0;
}
