//Bulbul khan-420...
#include <bits/stdc++.h>
#include <cstring>
#define ll long long int
#define pb() push_back()
#define f(i,n) for(i=0;i<n;i++)
using namespace std;
int main()
{
      ll t,a,b,c,d,i,j,k,l,n,m,x,y,z;
      cin>>n>>k;
      
      l=0;
     map<ll,ll>h;
     ll s[n+6];
    m=0;
    
    for(i=0;i<n;i++){
      cin>>a;
      m=max(m,a);
      h[a]++;
}
     for(i=0;i<=m+1;i++){
         a=h[i];
      
       if(a<k){
         b=k-a;
         l+=(b*i);
         k-=b;
}
       if(k==0)
         break;
       
   }
       cout<<l;

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

int main () {
    int N; cin >> N;
    vector<int> a(N); vector<int> b(N);
    for (int i = 0; i < N; i++) {
        cin >> a.at(i) >> b.at(i);    
    }
    double grad = 0;
    int ans = 0;
    for (int i = 0; i <= N-2; i++) {
        for (int j = N - 1; j > i; j--) {
            grad = (double)(b.at(i) - b.at(j)) / (a.at(i) - a.at(j));
            if (grad >= -1 && grad <= 1) ans++;
        }
    }
    cout << ans << endl;
}
