use std::fs;
use std::io::{stdin, Read};

macro_rules! parse {
    ($it: ident) => {
        $it.next().unwrap().parse().unwrap()
    };
    ($it: ident,2) => {
        (parse!($it), parse!($it))
    };
    ($it: ident,3) => {
        (parse!($it), parse!($it), parse!($it))
    };
    ($it: ident,4) => {
        (parse!($it), parse!($it), parse!($it), parse!($it))
    };
    ($it: ident, $n: expr) => {
        (&mut $it).take($n).map(|e| e.parse().unwrap()).collect();
    };
}

const MOD: usize = 998244353;

fn solve(s: &str) {
    let mut it = s.split_whitespace();
    let (n, s): (usize, usize) = parse!(it, 2);
    let a: Vec<usize> = parse!(it, n);
    let mut ret = 0;
    for l in 0..n {
        let mut dp = vec![vec![0; s + 1]; n + 1];
        dp[0][0] = 1;
        for i in 0..(a.len() - l) {
            for j in 0..(s + 1) {
                dp[i + 1][j] = dp[i][j]
                    + if a[i + l] <= j {
                        dp[i][j - a[i + l]]
                    } else {
                        0
                    };
                dp[i + 1][j] %= MOD;
            }
        }
        ret += (0..(a.len() - l + 1)).map(|i| dp[i][s]).sum();
        ret %= MOD;
    }
    println!("{}", ret);
}

fn test() {
    let mut f = fs::File::open("foo.txt").unwrap();
    let mut s = String::new();
    f.read_to_string(&mut s).unwrap();
    solve(&s);
}

fn main() {
    let mut s = String::new();
    stdin().read_to_string(&mut s).unwrap();
    solve(&s);
}

#[cfg(test)]
mod tests {
    use super::*;
    #[test]
    fn test_main() {
        test();
    }
    #[test]
    fn test_input() {
        let s = "
        ";
        solve(s);
    }
}
