#include <bits/stdc++.h>
using namespace std;
#define int long long
int n,k,x,a[1000001],tip,maxn,t,tt,ans,m[1000001];
signed main(){
cin>>n>>k;
for (int i=1;i<=n;i++){
cin>>x;
if (m[x]==0) a[++tip]=x;
m[x]++;
}
for (int i=1;i<=tip;i++){
if (m[a[i]]>maxn) maxn=m[a[i]],tt=1;
else if (m[a[i]]==maxn) tt++;
}
if (k==0) cout<<tt;
else if (maxn<=k) cout<<"pigstd";
else{
maxn-=2*k;
for (int i=1;i<=tip;i++){
if (tt==1&&maxn<=m[a[i]]) ans++;
else if (tt>1&&maxn<m[a[i]]) ans++;
}
cout<<ans;
}
return 0;
}
https://www.luogu.com.cn/record/116112144