import sys
read = sys.stdin.buffer.read

r = 998244353
 
n, s, *As = map(int, read().split())
import copy
answer = 0
f = [0]*3001
for A in As:
    c = copy.deepcopy(f)
    t = [0]*A
    f = t+c
    f = f[:-A]
    f = [x+y for x,y in zip(f,c)]
    f[0] += 1
    f[A] += 1
    answer += f[s]

answer %= r
print(answer)