program knapsack_for_all_subsets
  implicit none
  integer :: n, s, a(3000) = 0, i
  integer(8) :: md = 998244353, f(0:3000) = 0, g(0:3000)
  read(*,*) n, s
  read(*,*) a(1:n)
  f(0) = 1
  do i = 1, n
    g = f
    f(a(i):s) = f(a(i):s)+g(0:s-a(i))
    f = mod(f+g,md)
  end do
  write(*,'(i0)') f(s)
end program knapsack_for_all_subsets