N, K = map(int, input().split()) seqA = [int(input()) for _ in range(N)] seqA.sort(reverse=True) dp = [False for _ in range(K+1)] dp[0] = True for a in seqA: for i in range(K, a-1, -1): if dp[i] and i+a<=K: dp[i+a] = True if i <= K: dp[i] = True for i in range(K+1): if dp[K-i]: print(K-i)