import numpy as np
N,S = map(int,input().split())
list = np.int32(input().split())
A = np.zeros((N+1,S+1),dtype=np.int16)
B = np.zeros((N+1,S+1),dtype=np.int16)
C = np.zeros((N+1,S+1),dtype=np.int16)
A[0][0] = 1
for i in range(N):
    for j in range(S+1):
        A[i+1][j]+= A[i][j]
        A[i+1][j]%= 998244353
        B[i+1][j] += A[i][j] + B[i][j]
        B[i+1][j] %= 998244353
        C[i+1][j] += A[i][j]+ B[i][j] + C[i][j]
        C[i+1][j] %= 998244353
        if list[i] + j <= S:
            B[i+1][list[i]+j] += A[i][j] + B[i][j]
            B[i+1][list[i]+j] %= 998244353
            C[i+1][list[i]+j] += A[i][j] + B[i][j]
            C[i+1][list[i]+j] %= 998244353
print(C[N][S] % 998244353) 