from collections import Counter

M = 998244353
N, S = map(int, input().split())
A = list(map(int, input().split()))

ans = 0
prev = Counter()
for i, a in enumerate(A, 1):
  curr = Counter({a+s: c for s, c in prev.items() if a+s<=S})
  curr.update({a:i})
  ans = (ans + curr[S]*(N-i+1))%M
  curr.update(prev)
  prev = curr

print(ans)
    