program knapsack_for_all_segments
  implicit none
  integer(8), parameter :: modu = 998244353
  integer :: n, s, a(3000) = 0, i, j, k, m = 0
  integer(8) :: dp(0:1, 0:3000) = 0, x = 0
  read(*,*) n, s
  read(*,*) a(1:n)
  do i = 1, n
    dp(m, 0) = dp(m, 0) + 1
    dp(1 - m, :) = 0
    do j = 0, s
      dp(1 - m, j) = mod(dp(1 - m, j) + dp(m, j), modu)
      k = j + a(i)
      if (k <= s) dp(1 - m, k) = mod(dp(1 - m, k) + dp(m, j), modu)
    end do
    x = mod(x + dp(1 - m, s), modu)
    m = 1 - m
  end do
  write(*,'(i0)') x
end program knapsack_for_all_segments