#include using namespace std; int main(){ int N; long long K; cin >> N >> K; long long L[N+1],R[N+1]; vector> tmp; for(int i=1;i<=N;i++){ cin >> L[i] >> R[i]; tmp.push_back(make_pair(R[i],L[i])); } sort(tmp.begin(),tmp.end()); for(int i=1;i<=N;i++){ R[i]=tmp[i-1].first; L[i]=tmp[i-1].second; } long long ans=1e18; long long CurrentTime=0,Answer=0; for(int i=1;i<=N;i++){ if(CurrentTime<=L[i]){ CurrentTime=R[i]; Answer++; } if(Answer==K){ ans=CurrentTime-L[1]; break; } } if(Answer