import math
import numpy as np
import queue
from collections import deque,defaultdict
import heapq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n,s = map(int,ipt().split())
    a = [int(i) for i in ipt().split()]
    mod = 998244353
    ans = 0
    for i in range(n):
        dp = np.zeros(s+1,dtype=int)
        dp[0] = 1
        for j in range(i,n):
            aj = a[j]
            dpp = dp*1
            dpp[aj:] += dp[:-aj]
            dpp %= mod
            dp = dpp
            ans = (ans+dp[s]*(n-j))%mod
            dp[s] = 0
    print(ans)
    return

if __name__ == '__main__':
    main()
