import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); long k = sc.nextLong(); TreeMap map = new TreeMap<>(); int[] aArr = new int[n]; int[] bArr = new int[n]; for (int i = 0; i < n; i++) { aArr[i] = sc.nextInt(); bArr[i] = sc.nextInt() + 1; map.put(aArr[i], 0); map.put(bArr[i], 0); } int idx = 0; for (int x : map.keySet()) { map.put(x, idx); idx++; } int[] imos = new int[idx]; for (int i = 0; i < n; i++) { imos[map.get(aArr[i])]++; imos[map.get(bArr[i])]--; } for (int i = 1; i < idx; i++) { imos[i] += imos[i - 1]; } for (int x : map.keySet()) { if (map.get(x) == idx - 1) { break; } int next = map.higherKey(x); int count = imos[map.get(x)]; long size = next - x; if (k > size * count) { k -= size * count; } else { System.out.println(x + k / count); return; } } } }