let rec read t n =
  if n = 0 then ()
  else
    begin
      let a, b = Scanf.scanf "%d %d\n" (fun x y -> (x, y)) in
      if Hashtbl.mem t a then
        Hashtbl.replace t a (Hashtbl.find t a + b)
      else
        Hashtbl.replace t a b;
      read t (n-1)
    end

let rec solve k c = function
    [] -> 0
  | (x, y) :: rs -> if k <= c + y then x else solve k (c+y) rs
    
let () =
  let n, k = Scanf.scanf "%d %d\n" (fun x y -> (x, y)) in
  let tbl = Hashtbl.create n in
  read tbl n;
  let l = List.sort compare @@ Hashtbl.fold (fun a b c -> (a,b)::c) tbl [] in
  Printf.printf "%d\n" @@ solve k 0 l
