#include #define pt(sth) cout << sth << "\n" #define chmax(a, b) {if(ab) a=b;} #define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD using namespace std; typedef long long ll; typedef pair P; static const ll INF=1e18; static const ll MAX=101010; static const ll MOD=1e9+7; ll N, K; ll a[MAX], b[MAX]; ll C(ll x) { ll cnt=0; for(ll i=0; i=K; } int main(void) { cin >> N >> K; ll i; for(i=0; i> a[i] >> b[i]; b[i]++; } ll l=0, r=INF; while(l+1