import sys

def solve():
    input = sys.stdin.readline
    N, S = map(int, input().split())
    A = [int(a) for a in input().split()]
    DP = [[0] * (S + 1) for _ in range(N)]
    DP[0][0] = 1
    if A[0] <= S: DP[0][A[0]] = 1
    mod = 998244353
    for i in range(1, N):
        a = A[i]
        for s in range(S):
            if DP[i-1][s] > 0:
                DP[i][s] += DP[i-1][s]
                DP[i][s] %= mod
                if s + a <= S:
                    DP[i][s+a] += DP[i-1][s]
                    DP[i][s+a] %= mod
    Ans = 0
    for i in range(N):
        for j in range(i, N):
            out = (i + 1) * (N - j) % mod 
            if i == j: left = S - A[i]
            else: left = S - A[i] - A[j]
            if left < 0: continue
            elif left == 0:
                Ans += out 
                Ans %= mod
            else:
                if j - i > 1: inside = (DP[j - 1][left] - DP[i + 1][left] + mod) % mod
                else: inside = 0
                Ans += (inside * out) % mod
                Ans %= mod
    print(Ans)
    #print(DP)

    return 0

if __name__ == "__main__":
    solve()