Scanf.scanf "%d %d" (fun n k ->
    let hist = Array.make 100001 0 in
    for i = 1 to n do
        Scanf.scanf " %d %d" (fun a b ->
            hist.(a) <- hist.(a) + b;
        )
    done;

    let rec loop i asm =
        let asm = asm + hist.(i) in
        if asm >= k then i else loop (i + 1) asm
    in
    loop 1 0 |> Printf.printf "%d\n"
)