program abc159f
  implicit none
  integer :: n, s, i, j, ans
  integer,dimension(:),allocatable :: a, dp
  read *, n, s
  allocate(a(n),dp(0:s))
  read *, a
  dp = 0
  ans = 0
  do i = 1,n
     dp(0) = i
     do j = s,a(i),-1
        dp(j) = mod(dp(j)+dp(j-a(i)),998244353)
     end do
     ans = mod(ans+dp(s),998244353)
  end do
  print *, ans
end program abc159f
