#include <bits/stdc++.h>
using namespace std;

int main() {
    int n, k;
    cin >> n >> k;
    
    vector<int> values(n);
    for(int i = 0; i < n; i++){
        cin >> values[i];
    }
    
    map<int,int> mp;
    for(auto i: values){
    	mp[i]++;
    }
    
    // convert into vector<pair<int,int>>
    vector<pair<int,int>> vp;
    for(auto u: mp){
    	vp.push_back({u.first, u.second});
    }
    
    int noOfOperations = 0;
    
    for(int i = vp.size() - 1; i >= 1; i--){
    	vp[i-1].second += vp[i].second;
    	noOfOperations += vp[i].second;
    	vp[i].second = 0;
    }
    
    cout<<noOfOperations<<endl;
    
    return 0;
}