var
  n,s,sum:int64;
  a,f:array[0..3001] of int64;
  i,j:longint;
begin
  readln(n,s);
  for i:=1 to n do read(a[i]);
  for i:=1 to n do
    begin
      for j:=s downto a[i]+1 do f[j]:=(f[j]+f[j-a[i]]) mod 998244353;
      f[a[i]]:=(f[a[i]]+i) mod 998244353;
      sum:=(sum+(n-i+1)*f[s] mod 998244353) mod 998244353;
    end;
  writeln(sum);
end.