Score : 1000 points
Problem Statement
Given is a positive integer M and a sequence of N integers: A=(A1,A2,…,AN). Find the number, modulo 998244353, of sequences of N+1 integers, X=(X1,X2,…,XN+1), satisfying all of the following conditions:
- 1≤Xi≤M (1≤i≤N+1)
- AiXi≤Xi+1 (1≤i≤N)
Constraints
- 1≤N≤1000
- 1≤M≤1018
- 1≤Ai≤109
- ∏i=1NAi≤M
Input is given from Standard Input in the following format:
N M
A1 A2 … AN
Output
Print the number of integer sequences satisfying the conditions, modulo 998244353.
2 10
2 3
7
Seven sequences below satisfy the conditions.
- (1,2,6), (1,2,7), (1,2,8), (1,2,9), (1,2,10), (1,3,9), (1,3,10)
2 10
3 2
9
Nine sequences below satisfy the conditions.
- (1,3,6), (1,3,7), (1,3,8), (1,3,9), (1,3,10), (1,4,8), (1,4,9), (1,4,10), (1,5,10)
7 1000
1 2 3 4 3 2 1
225650129
5 1000000000000000000
1 1 1 1 1
307835847