N,T = gets.chomp.split(" ").map(&:to_i)
list = []
N.times do
list << gets.chomp.split(" ").map(&:to_i)
end
for food in list
  food << (food[1] / food[0].to_f)
end
time = 0
point = 0
max_food = list.sort_by!{|v| v[1]}.pop
serve = []
while time < T
  food = list.sort_by!{|v| v[2]}.pop
  if time + food[0] < T
    point += food[1]
    time += food[0]
    serve << food
  else
    point += max_food[1]
    time += max_food[0]
    serve << max_food
  end
end
puts point