let input = readLine()!.characters.split(" ").map{Int(String($0))!}
let (N, K) = (input[0], input[1])
var arr = [(Int, Int)]()
for _ in 0..<N {
  let input = readLine()!.characters.split(" ").map{Int(String($0))!}
  let (a, b) = (input[0], input[1])
  arr += [(a, b)]
}
print(arr.sort{$0.0 < $0.1}.map{(a, b) in (0..<b).map{_ in a}}.flatMap{$0}[K-1])