n,w=gets.split(" ").map{|e| e.to_i} ans=-1 n.times{ ui,wi=gets.split(" ").map{|e| e.to_i} ans=ui if wi<=w && ans