1117_D. Magic Gems
Reziba has many magic gems. Each magic gem can be split into M normal gems. The amount of space each magic (and normal) gem takes is 1 unit. A normal gem cannot be split.

Reziba wants to choose a set of magic gems and split some of them, so the total space occupied by the resulting set of gems is N units. If a magic gem is chosen and split, it takes M units of space (since it is split into M gems); if a magic gem is not split, it takes 1 unit.

How many different configurations of the resulting set of gems can Reziba have, such that the total amount of space taken is N units? Print the answer modulo 1000000007 (10^9+7). Two configurations are considered different if the number of magic gems Reziba takes to form them differs, or the indices of gems Reziba has to split differ.

Input

The input contains a single line consisting of 2 integers N and M (1 ≤ N ≤ 10^{18}, 2 ≤ M ≤ 100).

Output

Print one integer, the total number of configurations of the resulting set of gems, given that the total amount of space taken is N units. Print the answer modulo 1000000007 (10^9+7).

Examples

Input


4 2


Output


5


Input


3 2


Output


3

Note

In the first example each magic gem can split into 2 normal gems, and we know that the total amount of gems are 4.

Let 1 denote a magic gem, and 0 denote a normal gem.

The total configurations you can have is: 

  * 1 1 1 1 (None of the gems split); 
  * 0 0 1 1 (First magic gem splits into 2 normal gems); 
  * 1 0 0 1 (Second magic gem splits into 2 normal gems); 
  * 1 1 0 0 (Third magic gem splits into 2 normal gems); 
  * 0 0 0 0 (First and second magic gems split into total 4 normal gems). 



Hence, answer is 5.
```python
import sys

MOD = 10**9+7

def mult(A,B):
    n = len(A)
    C = []
    for x in range(n):
        c = [0]*n
        for z in range(n):
            b = B[x][z]
            a = A[z]
            for y in range(n):
                c[y] += a[y]*b
        for y in range(n):
            c[y]%=MOD
        C.append(c)
    return C

def vecmult(A,B):
    n = len(A)
    C = [0]*n
    for z in range(n):
        b = B[z]
        a = A[z]
        for y in range(n):
            C[y] += a[y]*b
    for y in range(n):
        C[y]%=MOD
    return C

n,m = [int(x) for x in input().split()]


#def DP(n):
#    if n<=0:
#        return 1 if n==0 else 0
#    else:
#        return DP(n-m) + DP(n-1)


mapper = [[0]*m for _ in range(m)]

mapper[0][0] = 1
mapper[-1][0] = 1
for i in range(m-1):
    mapper[i][i+1] = 1

def power(A,B,m):
    n = len(A)
    if m == 0:
        return B
    while m>8:
        if m%2==1:
            B = vecmult(A,B)
        A = mult(A,A)
        m//=2
    while m>0:
        B = vecmult(A,B)
        m-=1
    return B
    #return vecmult(A,B)

vec = [1]*m
vec = power(mapper,vec,n)
print(vec[-1]%MOD)
```