Scanf.scanf "%d %d" (fun n s ->
    let a = Array.init n (fun _ -> Scanf.scanf " %d" (fun a -> a)) in
    let dp = Array.make_matrix (n + 1) (s + 1) 0 in
    let m = 998244353 in
    let (+@) a b = (a + b) mod m in

    for i = 0 to n - 1 do
        let x = a.(i) in
        if x <= s then
            dp.(i + 1).(x) <- dp.(i + 1).(x) +@ (i + 1);
        for j = 0 to s do
            dp.(i + 1).(j) <- dp.(i + 1).(j) +@ dp.(i).(j);
            if j + x <= s then 
                dp.(i + 1).(j + x) <- dp.(i + 1).(j + x) +@ dp.(i).(j)
        done
    done;
    let rec loop i acc =
        if i > n then acc else loop (i + 1) (acc +@ dp.(i).(s))
    in
    loop 0 0 |> Printf.printf "%d\n"
)