n, k = gets.split.map(&:to_i) array = [] ans = 0 n.times do array << gets.to_i end 0.upto(2**n-1) do |i| temp = 0 num = "%0#{n}d" % i.to_s(2) n.times do |j| temp += array[j] if num[j] == "1" end ans = temp if ans < temp && temp <= k end puts ans