using System;
using System.Linq;
using System.Collections.Generic;

namespace Contest
{
    class Program
    {
        static void Main(string[] args)
        {
            ABC159.F();
        }

        class ABC159
        {
            public static void A()
            {
                var N = Read.Int();
                var M = Read.Int();
                Console.WriteLine(N * (N - 1) / 2 + M * (M - 1) / 2);
            }
            public static void B()
            {
                var S = Read.Str();
                bool ok = B_Kaibun(S) && B_Kaibun(S.Substring(0, (S.Length - 1) / 2)) && B_Kaibun(S.Substring((S.Length + 1) / 2, (S.Length - 1) / 2));
                Console.WriteLine(ok ? "Yes" : "No");
            }
            static bool B_Kaibun(string str)
            {
                for(int i = 0; i < str.Length / 2; ++i)
                {
                    if (str[i] != str[str.Length - 1 - i]) { return false; }
                }
                return true;
            }
            public static void C()
            {
                var L = Read.Int();
                Console.WriteLine(1.0 * L * L * L / 27);
            }
            public static void D()
            {
                var N = Read.Int();
                var A = Read.IntN();

                Dictionary<int, int> dict = new Dictionary<int, int>();
                foreach(var a in A)
                {
                    if (!dict.ContainsKey(a)) { dict.Add(a, 0); }
                    dict[a]++;
                }
                long count = 0;
                foreach(var kvp in dict)
                {
                    long v = kvp.Value;
                    count += v * (v - 1) / 2;
                }
                for(int i = 0; i < N; ++i)
                {
                    Console.WriteLine(count - (dict[A[i]] - 1));
                }
            }
            public static void E()
            {
                var H = Read.Int();
                var W = Read.Int();
                var K = Read.Int();
                var S = new List<int[]>();
                for (int i = 0; i < H; ++i)
                {
                    var s = Read.Str();
                    S.Add(s.Select(c => c == '1' ? 1 : 0).ToArray());
                }

                int[,] ASum = new int[H + 1, W + 1];
                for(int i = 0; i < H; ++i)
                {
                    for(int j = 0; j < W; ++j)
                    {
                        ASum[i + 1, j + 1] = ASum[i + 1, j] + ASum[i, j + 1] - ASum[i, j] + S[i][j];
                    }
                }
                int min = 1000000000;
                for(int i = 0; i < (1 << (H - 1)); ++i)
                {
                    Dictionary<int, int> pair = new Dictionary<int, int>();
                    int start = 0;
                    while (start < H)
                    {
                        int end = start + 1;
                        while (end < H && (i & (1 << (end - 1))) > 0)
                        {
                            end++;
                        }
                        pair.Add(start, end);
                        start = end;
                    }

                    int count = pair.Count - 2;
                    List<int> rights = new List<int>();
                    int left = 0;
                    while (left < W)
                    {
                        int right = left;
                        while (right < W && E_OK(ASum, pair, left, right+1, K))
                        {
                            right++;
                        }
                        if(left == right)
                        {
                            count = 1000000000;
                            break;
                        }
                        left = right;
                        rights.Add(right);
                        count++;
                    }
                    //if (min > count) { Console.WriteLine("{0} {1} {2}",i,count,String.Join("/",rights)); }
                    min = Math.Min(min, count);
                }
                Console.WriteLine(min);
            }
            static bool E_OK(int[,] Asum, Dictionary<int,int> pair, int startW, int endW, int K)
            {
                foreach(var kvp in pair)
                {
                    if (E_Count(Asum, kvp.Key, kvp.Value, startW, endW) > K) { return false; }
                }
                return true;
            }
            static int E_Count(int[,] Asum, int startH, int endH, int startW,int endW)
            {
                //Console.WriteLine("{0} {1} {2} {3} {4}",startH,endH,startW,endW, Asum[endH + 0, endW + 0] - Asum[startH, endW + 0] - Asum[endH + 0, startW] + Asum[startH, startW]);
                return Asum[endH + 0, endW + 0] - Asum[startH, endW + 0] - Asum[endH + 0, startW] + Asum[startH, startW];
            }
            public static void F()
            {
                var N = Read.Int();
                var S = Read.Int();
                var A = Read.IntN();
                var P = 998244353;
                var dp = new long[S + 1];
                long count = 0;
                for(int n = 0; n < N; ++n)
                {
                    dp[0]++;
                    var a = A[n];
                    for(int s = S; s >= 0; --s)
                    {
                        if (s >= a) { dp[s] = (dp[s] + dp[s - a]) % P; }
                    }
                    count = (count + dp[S]) % P;
                }
                Console.WriteLine(count);
            }
        }

        class Util
        {
        }


        static class Read
        {
            static Queue<string> queue = new Queue<string>();
            static void Enqueue() { var ss = Console.ReadLine().Split(' '); foreach (var s in ss) { queue.Enqueue(s); } }
            public static int Int() { if (queue.Count == 0) { Enqueue(); } return Convert.ToInt32(queue.Dequeue()); }
            public static long Long() { if (queue.Count == 0) { Enqueue(); } return Convert.ToInt64(queue.Dequeue()); }
            public static string Str() { if (queue.Count == 0) { Enqueue(); } return queue.Dequeue(); }
            public static int[] IntN() { return Console.ReadLine().Split(' ').Select(s => Convert.ToInt32(s)).ToArray(); }
            public static long[] LongN() { return Console.ReadLine().Split(' ').Select(s => Convert.ToInt64(s)).ToArray(); }
            public static string[] StrN() { return Console.ReadLine().Split(' '); }
            public static Tuple<int, int>[] TupleInt(int n) { List<Tuple<int, int>> list = new List<Tuple<int, int>>(); for (int i = 0; i < n; ++i) { var ab = Read.IntN(); list.Add(new Tuple<int, int>(ab[0], ab[1])); } return list.ToArray(); }
            public static Tuple<long, long>[] TupleLong(int n) { List<Tuple<long, long>> list = new List<Tuple<long, long>>(); for (int i = 0; i < n; ++i) { var ab = Read.LongN(); list.Add(new Tuple<long, long>(ab[0], ab[1])); } return list.ToArray(); }
            public static Tuple<string, string>[] TupleStr(int n) { List<Tuple<string, string>> list = new List<Tuple<string, string>>(); for (int i = 0; i < n; ++i) { var ab = Read.StrN(); list.Add(new Tuple<string, string>(ab[0], ab[1])); } return list.ToArray(); }
            public static Tuple<double, double>[] TupleDouble(int n) { List<Tuple<double, double>> list = new List<Tuple<double, double>>(); for (int i = 0; i < n; ++i) { var ab = Read.LongN(); list.Add(new Tuple<double, double>(ab[0], ab[1])); } return list.ToArray(); }
            public static long[,] LongMatrix(int r, int c)
            {
                var mat = new long[r, c];
                for (int i = 0; i < r; ++i)
                {
                    var x = Read.LongN();
                    for (int j = 0; j < c; ++j)
                    {
                        mat[i, j] = x[j];
                    }
                }
                return mat;
            }
            public static Dictionary<int, HashSet<int>> AdjacencyList(int N, int M)
            {
                Dictionary<int, HashSet<int>> dict = new Dictionary<int, HashSet<int>>();
                for (int i = 0; i <= N; ++i)
                {
                    dict.Add(i, new HashSet<int>());
                }
                for (int i = 0; i < M; ++i)
                {
                    var ab = Read.IntN();
                    dict[ab[0]].Add(ab[1]);
                    dict[ab[1]].Add(ab[0]);
                }
                return dict;
            }
            public static Dictionary<int, Dictionary<int, long>> AdjacencyListWithWeight(int N, int M)
            {
                Dictionary<int, Dictionary<int, long>> dict = new Dictionary<int, Dictionary<int, long>>();
                for (int i = 0; i <= N; ++i)
                {
                    dict.Add(i, new Dictionary<int, long>());
                }
                for (int i = 0; i < M; ++i)
                {
                    var ab = Read.IntN();
                    dict[ab[0]].Add(ab[1], ab[2]);
                    dict[ab[1]].Add(ab[0], ab[2]);
                }
                return dict;
            }
        }
    }
}


Measured memory_bytes: 13524