input_line = gets.chomp!.split(' ').map{|n| n.to_i} v_line = [] for i in 1..input_line[0] input_line2 = gets.chomp!.split(' ').map{|n| n.to_i} if input_line2[1] <= input_line[1] then v_line.push(input_line2[0]) end end if v_line == [] then puts -1 end puts v_line.max