mod = 998244353
N,S = map(int,input().split())
A = list(map(int,input().split()))

dp = [[[0]*2 for s in range(3001)] for i in range(N)]

for n in range(N):
    for s in range(3000,-1,-1):
        dp[n][s][1] = dp[n-1][s][1]
        dp[n][s][0] = dp[n-1][s][0]
        if s>A[n]:
            dp[n][s][1] += dp[n-1][s-A[n]][0]*(N-n)
            dp[n][s][0] += dp[n-1][s-A[n]][0]
        elif s==A[n]:
            dp[n][s][1] += (n+1)*(N-n)
            dp[n][s][0] += n+1
        dp[n][s][1] %= mod
        dp[n][s][0] %= mod

print(dp[N-1][S][1])