loop do
  n,m = gets.chomp.split.map(&:to_i)
  break if (n|m) == 0
  targets = []
  n.times do
    targets << gets.chomp.to_i
  end
  targets.sort!{ |a,b| b <=> a }

  rest = m
  high_score = 0
  targets.each do |target|
    high_score += (rest / target) * target
    rest = rest % target
  end
  puts high_score
end