vec = []

loop do
  n, m = gets.split.map(&:to_i)
  break if n.zero? && m.zero?

  as = gets.split.map(&:to_i)
  max = 0
  pq = []

  as.each do |a|
    cq = pq.dup
    until cq.empty?
      current_sum = a + cq.pop
      if current_sum <= m
        max = [max, current_sum].max
        break
      end
    end

    pq << a
    pq.sort!
  end

  vec << max
end

vec.each do |v|
  puts v.zero? ? 'NONE' : v
end

