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
  start = 0
  last = histry.size - 1
  pos = 0
  while start <= last
    pos = start + (last - start) / 2
    if histry[pos].year > year
      last = pos - 1
    elsif histry[pos].year < year and start != pos
      start = pos
    else
      break
    end
  end
  histry[pos].name
end

main