from sys import stdin n, m, *a = map(int, stdin.read().split()) maxbit = (1<<(m+1)) - 1 dp = [0 for i in range(n+1)] dp[0] = 1 for i in range(n): dp[i+1] = (dp[i] | (dp[i] << a[i])) & maxbit if dp[n] & (1<> a[i])) print("{}".format(ans))