> [!NOTE] Problem
> **Input**: The first input line has two integers $n$ and $x$: the number of coins and the desired sum of money. The second line has $n$ distinct integers $c_{1},c_{2},\dots,c_{n}$: the value of each coin.
>
>**Output**: Print one integer: the number of distinct ordered ways you can produce a money sum $x$ using the available coins modulo $10^{9}+7.$
>
>**Constraints:**
>- $1 \leq n \leq 100$
>- $1 \leq x\leq 10^{6}$
>- $1 \leq c_{i} \leq 10^{6}$
> [!Example] Example
> **Input**:
> 3 9
> 2 3 5
>
> **Output**:
> 3
>
>Since if the coins are $\{ 2,3,5 \}$ and desired sum is $9,$ there are $3$ ways:
>- $2 +2+5$
>- $3+3+3$
>- $2+2+2+3$
Solution. Let $T(k,l)$ denote the number of distinct ordered ways to produce $k$ using where the largest coin is $c_{l}.$ Our goal is to find $T(x,n).$ We have $T(k,n) = T(k-c_{n},n)+T(k-c_{n-1},n-1)+\dots+ T(k-c_{1},1)$
```run-python
max_x = 10**6
max_n = 100
md = 10**9+7
# n, x = list(map(int, input().split()))
# c = list(map(int, input().split()))
n, x = 3, 9
c = [2,3,5]
dp = [[0]*(3+1)]*(9+1)
print(dp)
for i in range(1,n+1):
dp[0][i] = 1
for i in range(1,n+1):
for k in range(1,x+1):
if(k-c[i]>=0): dp[k][i] = (dp[k][i] + dp[k-c[i]][i]) % md
print(dp[x][n])
```
```run-python
max_x = 10**6
md = 10**9+7
# n, x = list(map(int, input().split()))
# c = list(map(int, input().split()))
n, x = 3, 9
c = [2,3,5]
dp = [0]*(max_x+1); dp[0]=1
for i in range(n):
for k in range(1,x+1):
if(k-c[i]>=0): dp[k] = (dp[k] + dp[k-c[i]]) % md
print(dp[x])
```