#include using namespace std; typedef long long ll; ll n,m,MOD,a,b,ans,bik[400001],c,st,go,mid; vector v,u; ll f(ll mid){ ll tot=0; for(int i=0;i>n>>m>>MOD; for(int i=0;i>a; v.push_back(a%MOD); } for(int i=0;i>a; u.push_back(a%MOD); } sort(u.begin(),u.end()); st=-1,go=MOD-1; while(go-st>1){ mid=(st+go)/2; ll tmp=f(mid); if(tmp>=m)go=mid; else st=mid; } cout<