N,S = map(int, input().split())
A = [int(x) for x in input().split()]

L = 0
R = 1
L_max = N-1
R_max = N
count = 0

while L <= L_max:
    while sum(A[L:R]) <= S:
#         print(L,R)

        if sum(A[L:R]) == S:
#             print("HIT!",L,R,(L+1) * (N-R+1))
#             count += N - (R-1-L)
            count += (L+1) * (N-R+1)
            break

        if R <= R_max and L <= L_max:
            if sum(A[L:R]) < S:
                R += 1
            else:
                L += 1
        else:
            break
    L += 1


print(count % 998244353)