We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.

- Prepare
- Algorithms
- Dynamic Programming
- P-sequences

# P-sequences

# P-sequences

We call a sequence of `N`

natural numbers (*a*_{1}, *a*_{2}, ..., *a*_{N}) a *P-sequence*, if the product of any two adjacent numbers in it is not greater than *P*. In other words, if a sequence (*a*_{1}, *a*_{2}, ..., *a*_{N}) is a *P-sequence*, then *a*_{i} * *a*_{i+1} ≤ `P`

∀ 1 ≤ i < N

You are given `N`

and `P`

. Your task is to find the number of such *P-sequences* of `N`

integers modulo 10^{9}+7.

**Input Format**

The first line of input consists of `N`

The second line of the input consists of `P`

.

**Constraints**

2 ≤ N ≤ 10^{3}

1 ≤ P ≤ 10^{9}

1 ≤ a_{i}

**Output Format**

Output the number of *P-sequences* of `N`

integers modulo 10^{9}+7.

**Sample Input 0**

```
2
2
```

**Sample Output 0**

```
3
```

**Explanation 0**

3 such sequences are {1,1},{1,2} and {2,1}