def main():
  mod = 998244353

  dp = [[[0]*3 for i in range(3030)] for j in range(3030)];

  n,k = map(int,input().split())
  a = list(map(int,input().split()))
  dp[0][0][0] = 1;
  for i in range(n):
      for j in range(k+1):
        dp[i+1][j][0] = (dp[i+1][j][0] + dp[i][j][0]) % mod
        dp[i+1][j][1] = (dp[i+1][j][1] + dp[i][j][0] + dp[i][j][1]) % mod
        dp[i+1][j][2] = (dp[i+1][j][2] + dp[i][j][0] + dp[i][j][1] + dp[i][j][2]) % mod
        if j + a[i] <= k:
          dp[i+1][j+a[i]][1] = (dp[i+1][j+a[i]][1] + dp[i][j][0] + dp[i][j][1]) % mod
          dp[i+1][j+a[i]][2] = (dp[i+1][j+a[i]][2] + dp[i][j][0] + dp[i][j][1]) % mod
            
        
    
  print(dp[n][k][2])
  
if __name__ == '__main__':
  main()