Affinity for Artifacts

AtCoder
IDarc207_a
Time2000ms
Memory256MB
Difficulty
Snuke the wizard has $N$ magical lamps numbered $1$ to $N$. The cost of the $i$\-th lamp is $a_i$. Initially, none of the lamps are lit. Snuke has an integer value called MP, which is initially $X$. When Snuke lights a lamp with cost $x$, his MP decreases by $x$. Each time Snuke lights one lamp, the cost of all lamps with cost at least $1$ decreases by $1$. There are $N!$ possible orders to light the lamps. Find the number, modulo $998244353$, of such orders where MP never becomes negative. ## Constraints * $1 \le N \le 100$ * $0 \le a_i \le 10^{9}$ * $0 \le X \le 10^9$ * All input values are integers. ## Input The input is given from Standard Input in the following format: $N$ $X$ $a_1$ $a_2$ $\dots$ $a_N$ [samples]
Samples
Input #1
3 1
0 1 2
Output #1
3

We explain one order where MP never becomes negative.

*   First, light lamp $1$. MP decreases by $0$.
*   Next, light lamp $3$. MP decreases by $1$.
*   Finally, light lamp $2$. MP decreases by $0$.

Note that the cost of a lamp never becomes negative.
Input #2
6 8
2 1 4 8 1 4
Output #2
176
Input #3
20 50
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
Output #3
63942667

Do not forget to find the remainder modulo $998244353$.
API Response (JSON)
{
  "problem": {
    "name": "Affinity for Artifacts",
    "description": {
      "content": "Snuke the wizard has $N$ magical lamps numbered $1$ to $N$. The cost of the $i$\\-th lamp is $a_i$. Initially, none of the lamps are lit. Snuke has an integer value called MP, which is initially $X$. W",
      "description_type": "Markdown"
    },
    "platform": "AtCoder",
    "limit": {
      "time_limit": 2000,
      "memory_limit": 262144
    },
    "difficulty": "None",
    "is_remote": true,
    "is_sync": true,
    "sync_url": null,
    "sign": "arc207_a"
  },
  "statements": [
    {
      "statement_type": "Markdown",
      "content": "Snuke the wizard has $N$ magical lamps numbered $1$ to $N$. The cost of the $i$\\-th lamp is $a_i$. Initially, none of the lamps are lit.\nSnuke has an integer value called MP, which is initially $X$. W...",
      "is_translate": false,
      "language": "English"
    }
  ]
}
Full JSON Raw Segments