let m = 998244353
let ( +^ ) x y = (x + y) mod m
let ( *^ ) x y = (x * y) mod m

let () = Scanf.scanf "%d %d\n" @@ fun n s ->
  let as_ = Array.init n @@ fun _ -> Scanf.scanf "%d " @@ fun a -> a in
  let result = ref 0 in
  let dp = Array.make 3001 0 in
  for i = 0 to n - 1 do
    for j = s downto as_.(i) + 1 do
      dp.(j) <- dp.(j) +^ dp.(j - as_.(i))
    done;
    dp.(as_.(i)) <- dp.(as_.(i)) +^ (i + 1);
    result := !result +^ dp.(s) *^ (n - i);
    dp.(s) <- 0;
  done;
  Printf.printf "%d\n" @@ !result
