"""Lの上位20bit, 下位20bitで分けて半分全列挙""" U = 1 << 20 N, L = map(int, input().split()) W = list(map(int, input().split())) dp = [0] * U dp[0] = 1 for w in W: for i in range(w, U): dp[i] |= dp[i-w] dp_sum = [0] * (U + 1) for i in range(1, U+1): dp_sum[i] = dp_sum[i-1] + dp[i-1] ans = 0 for i in range(U): if dp[i]: target = L - (i << 20) target = min(target, U) if target < 0: break ans += dp_sum[target] print(ans)