program abc159f
  integer :: n, s, i, ans=0, a(3000), dp(0:3000)=0
  read *, n, s
  read *, a(:n)
  do i = 1,n
     dp(0) = i
     dp(a(i):s) = mod(dp(:s-a(i))+dp(a(i):s),998244353)
     ans = mod(ans+dp(s),998244353)
  end do
  print *, ans
end program abc159f
