import sys
def main():
    input = sys.stdin.readline
    N,S = map(int, input().split())
    A = list(map(int, input().split()))

    dp0 = [[0 for _ in range(S+1)] for _ in range(N+1)]
    dp1 = [[0 for _ in range(S+1)] for _ in range(N+1)]
    dp2 = [[0 for _ in range(S+1)] for _ in range(N+1)]
    dp0[0][0] = 1
    for i in range(N):
        a = A[i]
        dp0i = dp0[i]
        dp1i = dp1[i]
        dp2i = dp2[i]
        dp0n = dp0[i+1]
        dp1n = dp1[i+1]
        dp2n = dp2[i+1]
        for j in range(S+1):
            dp0ij = dp0i[j]
            dp1ij = dp1i[j]

            dp0n[j] = mod_add(dp0n[j], dp0ij)
            dp1n[j] = mod_add(dp1n[j], dp1ij)
            dp2n[j] = mod_add(dp2n[j], dp2i[j])

            if j+a > S: continue
            to1 = dp0ij * (i+1)
            to1 += dp1ij
            dp1n[j+a] = mod_add(dp1n[j+a], to1)
            to1 *= (N-i)
            dp2n[j+a] = mod_add(dp2n[j+a], to1)

    print(dp2[N][S])

MOD = 998244353

def mod_inverse(self):
    a, b = self.value, MOD
    u, v = 1, 0
    while b:
        t = a // b
        b, a = a - t * b, b
        v, u = u - t * v, v
    if u < 0: u += MOD
    return u

def mod_add(self, other):
    self += other
    if self >= MOD: self -= MOD
    return self

def mod_sub(self, other):
    self -= other
    if self < 0: self += MOD
    return self

def mod_mul(self, other):
    self = self * other % MOD
    return self

def mod_div(self, other):
    self *= mod_inverse(other)
    return self

if __name__ == '__main__':
    main()