N, S = map(int, input().split())
data = list(map(int, input().split()))

MOD = 998244353
# dp = [[0]*(3000+1) for _ in range(N)]
# ans = 0

# for i, num in enumerate(data):
#     dp[i][num] = 1
#     for j in range(i):
#         for k in range(S-num, 0, -1):
#             if dp[j][k] >= 1:
#                 dp[j][k+num] += dp[j][k]
#             if k == num:
#                 dp[j][num] += 1
#     for j in range(i+1):
#         ans += dp[j][S]
#     ans %= MOD

# print(ans)

ans = 0
dp = [[] for _ in range(3001)]
dp[0] = [0]
for i, num in enumerate(data):
    for j in range(S-num, -1, -1):
        for item in dp[j]:
            dp[j+num] += [item+(1<<i)]

for item in dp[S]:
    for i in range(N+1):
        if item < (1<<i):
            a = N - i + 1
            break
    for i in range(N):
        if item & (1<<i) != 0:
            b = i + 1
            break
    ans = (a*b+ans)%MOD

print(ans)
