import sys; input = sys.stdin.buffer.readline sys.setrecursionlimit(10**7) from collections import defaultdict con = 10 ** 9 + 7; INF = float("inf") def getlist(): return list(map(int, input().split())) #処理内容 def main(): N, K = getlist() DP = [0] * (2 * 10 ** 6 + 1) DP[0] = 1 for i in range(N): A = int(input()) for j in range(2 * 10 ** 6, -1, -1): if DP[j] == 1: DP[j + A] = 1 ans = 0 for i in range(K + 1): if DP[i] == 1: ans = i print(ans) if __name__ == '__main__': main()