import sys

def solve():
    input = sys.stdin.readline
    N, S = map(int, input().split())
    A = [int(a) for a in input().split()]
    DPR = [[0] * (S + 1) for _ in range(N)]
    DPR[0][0] = 1
    DPL = [[0] * (S + 1) for _ in range(N)]
    DPL[N-1][0] = 1

    if A[0] <= S: DPR[0][A[0]] = 1
    if A[N-1] <= S: DPL[N-1][A[N-1]] = 1
    mod = 998244353
    Ans = 0
    if A[0] == S: Ans += N
    if A[N-1] == S: Ans += N
    for i in range(1, N):
        a = A[i]
        ar = A[N-1-i]
        for s in range(S):
            if DPR[i-1][s] > 0:
                DPR[i][s] += DPR[i-1][s]
                DPR[i][s] %= mod
                if s + a <= S:
                    DPR[i][s+a] += DPR[i-1][s]
                    DPR[i][s+a] %= mod
        if a <= S: 
            Ans += ((N - i) * DPR[i-1][S-a]) % mod
            Ans %= mod

        for s in range(S):
            if DPL[N-i][s] > 0:
                DPL[N-i-1][s] += DPL[N-i][s]
                DPL[N-i-1][s] %= mod
                if s + ar <= S:
                    DPL[N-i-1][s+ar] += DPL[N-i][s]
                    DPL[N-i-1][s+ar] %= mod
        if ar <= S: 
            Ans += ((N-i+1) * DPL[N - i][S-ar]) % mod
            Ans %= mod

   
    print(Ans)
    #print(DP)

    return 0

if __name__ == "__main__":
    solve()