class Rename
  def initialize year, name
    @year = year
    @name = name
  end
  attr_reader :year, :name
end

def main
  n,q = gets.chomp.split.map(&:to_i)
  histry = []
  histry << Rename.new(0, 'kogakubu10gokan')
  n.times do
    year_str,name = gets.chomp.split
    histry << Rename.new(year_str.to_i, name)
  end
  puts get_name(histry, q)
end

def get_name histry, year
  answer = ''
  histry.each do |rename|
    if rename.year == year
      answer = rename.name
      break
    elsif rename.year < year
      answer = rename.name
    else
      break
    end
  end
  answer
end

main