//GIVE ME AC!!!!!!!!!!!!!!!!! #pragma GCC target("avx") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") #include using namespace std; using ll=long long; using ld=long double; using vl=vector; using vi=vector; using vs=vector; using vc=vector; using vvl=vector; using P=pair; using vvc=vector; using vd=vector; using vp=vector

; using vb=vector; #define overload4(_1,_2,_3,_4,name,...) name #define overload3(_1,_2,_3,name,...) name #define rep1(a) for(decltype(a) i=0;i=0;i--) #define rrep2(i,a) for(decltype(a) i=(a)-1;i>=0;i--) #define rrep3(i,a,b) for(decltype(a) i=(b)-1;i>=(a);i--) #define rrep(...) overload3(__VA_ARGS__,rrep3,rrep2,rrep1)(__VA_ARGS__) #define all1(i) begin(i),end(i) #define all2(i,a) begin(i),begin(i)+a #define all3(i,a,b) begin(i)+a,begin(i)+b #define all(...) overload3(__VA_ARGS__,all3,all2,all1)(__VA_ARGS__) #define rall(n) (n).rbegin(),(n).rend() #define pb push_back #define eb emplace_back #define MtSaka ios::sync_with_stdio(0);cin.tie(0);cout< ostream &operator<<(ostream&os,const pair&p){os< istream &operator>>(istream&is,pair&p){is>>p.first>>p.second;return is;} template ostream &operator<<(ostream&os,const vector&v){for(int i=0;i<(int)v.size();i++){os< istream &operator>>(istream&is,vector&v){for(T &in:v){is>>in;}return is;} void scan(){} template void scan(Head&head,Tail&... tail){cin>>head;scan(tail...);} template void print(const T &t){cout< void print(const Head &head, const Tail &... tail){cout< void fin(const T &... a){print(a...);exit(0);} template T sum_(vectora){return accumulate(all(a),T(0));} template inline bool chmax(T1&a,T2 b){return a inline bool chmin(T1&a,T2 b){return a>b&&(a=b,true);} int main(){ MtSaka; LL(n,d); vp p(n); scan(p); ll ng=0,ok=1e9; while(ok-ng>1){ ll mid=(ok+ng)/2; //print(mid); ll s=0; ll before=-1; bool f=true; rep(i,d){ ll a=inf; ll now=-1; rep(j,n){ if(mid-s