n = gets.to_i
t = gets.to_i

cost = []
time = []
for i in 0...n do
  cost << gets.to_i
  time << gets.to_i
end

list = []
for k in 0...n do
  if t >= time[k]
    list << cost[k]
  end
end
 min = 1000
for i in 0...list.length do
  if min >= list[i]
    min = list[i]
  end
end

if list.length == 0
  puts "TEL"
else
  puts min
end
