atcoder#ARC148E. [ARC148E] ≥ K

[ARC148E] ≥ K

Score : 800800 points

Problem Statement

You are given a sequence of length NN, A=(A1,...,AN)A = (A_1, ..., A_N), and an integer KK. How many permutations of AA are there such that no two adjacent elements sum to less than KK? Find the count modulo 998244353998244353.

Constraints

  • 2N2×1052 \leq N \leq 2 \times 10^5
  • 0K1090 \leq K \leq 10^9
  • 0Ai1090 \leq A_i \leq 10^9
  • All values in the input are integers.

Input

The input is given from Standard Input in the following format:

NN KK

A1A_1 A2A_2 \dots ANA_N

Output

Print the answer.

4 5
1 2 3 4
4

The following four permutations satisfy the condition:

  • (1,4,2,3)(1, 4, 2, 3)
  • (1,4,3,2)(1, 4, 3, 2)
  • (2,3,4,1)(2, 3, 4, 1)
  • (3,2,4,1)(3, 2, 4, 1)
4 3
1 2 3 3
12

There are 1212 permutations of AA, all of which satisfy the condition.

10 7
3 1 4 1 5 9 2 6 5 3
108