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