Under construction

Still being built. Things may change

All Kill

Time limit1sMemory limit512 MB

Summary
Given n coding times and a contest of t minutes, find p times t^n mod 998244353, where p is the chance that all problems are coded in full, each as one contiguous block, before the end.
Level

Hard8 of 10

Topics
Dynamic programming, Combinatorics, Probability
Solved
No attempts yet

Problem

You just finished a programming contest with your friend. You were unable to All Kill the contest (solve every problem), but you wonder whether some strategy would have solved all of them.

Solving a problem has two phases, a thinking phase and a coding phase. Your friend does all the thinking, and you do all the coding.

For each problem, you know exactly how many minutes it takes you to code it. Before you can code a problem during the contest, your friend must first get the idea for it. You do not know when that happens, so the model is this: for every problem, your friend gets the idea at a uniformly random minute during the contest. Each of these is an independent random variable. You can code only one problem at a time, so several problems may be queued at any moment. You always code the lowest numbered problem first. You work minute by minute, so you switch to a lower numbered problem if your friend gets its idea before you finish the higher numbered one. You would prefer not to switch, since context switching is expensive, even in the human brain.

Each minute proceeds as follows.

  • For each problem that does not yet have an idea, your friend gets the idea with probability 1number of minutes remaining in the contest\frac{1}{\text{number of minutes remaining in the contest}}. Your friend can get the ideas for several problems in the same minute.
  • Among the problems that still need coding time and have an idea, you take the lowest numbered one and spend the next minute coding it. If no problem qualifies, you do nothing.

Find the probability that both of the following happen together:

  • Your team finishes coding all the problems by the end of the contest.
  • For each problem, the minutes spent coding that problem form a contiguous interval.

Let pp be this probability, nn the number of problems, and tt the number of minutes in the contest. It can be shown that p⋅tnp \cdot t^n is an integer.

Input

The first line contains two space-separated integers nn (1≤n≤1051 \le n \le 10^5) and tt (1≤t≤1081 \le t \le 10^8), where nn is the number of problems and tt is the number of minutes in the contest.

Each of the next nn lines contains a single integer xx (1≤x≤1031 \le x \le 10^3), the number of minutes needed to code each problem, in order. The sum of these times is at most tt.

Output

Output a single integer, the value of (p⋅tn) mod 998,244,353(p \cdot t^n) \bmod 998{,}244{,}353, where pp is the probability of the two events happening together. Note that 998,244,353 is a large prime.

Examples2

  1. Example 1

    Input
    3 5
    1
    2
    1
    
    Expected output
    60
    
  2. Example 2

    Input
    5 5
    1
    1
    1
    1
    1
    
    Expected output
    1296