import numpy as np
n,s=map(int,input().split())
a=list(map(int,input().split()))
mod=998244353
ans=0
dp=np.zeros((n+1,3001),np.int64)
for l in range(n):
  dp=np.zeros((n+1,3001),np.int64)
  dp[:,0]=1
  for i in range(l,n):
    dp[i+1]=dp[i]
    dp[i+1,a[i]:]+=dp[i,:-a[i]]
    dp[i+1:]%=mod
    ans+=dp[i+1,s]
    ans%=mod
print(ans)