const MOD: usize = 998_244_353;

fn main() {
    let (n, s): (usize, usize) = {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        let mut iter = buf.split_whitespace();
        (
            iter.next().unwrap().parse().unwrap(),
            iter.next().unwrap().parse().unwrap(),
        )
    };

    let a: Vec<usize> = {
        let mut buf = String::new();
        std::io::stdin().read_line(&mut buf).unwrap();
        let iter = buf.split_whitespace();
        iter.map(|x| x.parse().unwrap()).collect()
    };

    let mut ans = 0;
    let mut dp = vec![0; s + 1];
    for i in 0..n {
        if s < a[i] { continue; }
        for j in (0..=(s - a[i])).rev() {
            dp[j + a[i]] = (dp[j + a[i]] + dp[j]) % MOD;
        }
        dp[a[i]] = (dp[a[i]] + (i + 1)) % MOD;
        ans = (ans + dp[s]) % MOD;
    }
    println!("{}", ans);
}