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.
import java.util.*;
import java.io.*;
import java.math.*;
public class Main
{
    static class Reader
    {
        private InputStream mIs;private byte[] buf = new byte[1024];private int curChar,numChars;public Reader() { this(System.in); }public Reader(InputStream is) { mIs = is;}
        public int read() {if (numChars == -1) throw new InputMismatchException();if (curChar >= numChars) {curChar = 0;try { numChars = mIs.read(buf);} catch (IOException e) { throw new InputMismatchException();}if (numChars <= 0) return -1; }return buf[curChar++];}
        public String nextLine(){int c = read();while (isSpaceChar(c)) c = read();StringBuilder res = new StringBuilder();do {res.appendCodePoint(c);c = read();}while (!isEndOfLine(c));return res.toString() ;}
        public String s(){int c = read();while (isSpaceChar(c)) c = read();StringBuilder res = new StringBuilder();do {res.appendCodePoint(c);c = read();}while (!isSpaceChar(c));return res.toString();}
        public long l(){int c = read();while (isSpaceChar(c)) c = read();int sgn = 1;if (c == '-') { sgn = -1 ; c = read() ; }long res = 0; do{ if (c < '0' || c > '9') throw new InputMismatchException();res *= 10 ; res += c - '0' ; c = read();}while(!isSpaceChar(c));return res * sgn;}
        public int i(){int c = read() ;while (isSpaceChar(c)) c = read();int sgn = 1;if (c == '-') { sgn = -1 ; c = read() ; }int res = 0;do{if (c < '0' || c > '9') throw new InputMismatchException();res *= 10 ; res += c - '0' ; c = read() ;}while(!isSpaceChar(c));return res * sgn;}
        public double d() throws IOException {return Double.parseDouble(s()) ;}
        public boolean isSpaceChar(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; }
        public boolean isEndOfLine(int c) { return c == '\n' || c == '\r' || c == -1; }
        public int[] arr(int n){int[] ret = new int[n];for (int i = 0; i < n; i++) {ret[i] = i();}return ret;}
    }
   
   
 
           //       |----|       /\      |    |   -----   |
           //       |   /       /  \     |    |     |     |
           //       |--/       /----\    |----|     |     |
           //       |   \     /      \   |    |     |     |
           //       |    \   /        \  |    |   -----   -------
 
    static int p,q,n;
    static long map[][];
    static long mod=1000000007;
    static int size;
    public static long[][] expo(long pow)  
    {
        long ans[][]=new long[size][size];
        for(int i=0;i<size;i++)    
        ans[i][i]=1;
        while(pow!=0)
        {
            if((pow&1)!=0)  
                ans=multiplyMatrix(ans, map);
            map=multiplyMatrix(map, map);
            pow/=2;
        }
        return ans;
    }
    public static long[][] multiplyMatrix(long m[][], long m2[][])  
    {
        long ans[][]=new long[size][size];
        for(int i=0;i<size;i++)
        for(int j=0;j<size;j++)
        {
            ans[i][j] = 0;
            for(int k=0;k<size;k++)
            {
                ans[i][j]+=(m[i][k]*m2[k][j]);
                if(ans[i][j]>=mod)
                ans[i][j]%=mod;
            }
        }
        return  ans;
    }
    public static void main(String[] args)throws IOException
    {
        PrintWriter out= new PrintWriter(System.out);
        Reader sc=new Reader();
        long n=sc.l();
        int m=sc.i();
        size=m;
        if(n<m)
        out.println(1);
        else
        {
            map=new long[size][size];
            for(int i=0;i<m;i++)
            {
                if(i==0)
                {
                    map[i][0]=1;
                    map[i][m-1]=1;
                }
                else
                map[i][i-1]=1;
            }
            long ans[][]=expo(n-m+1);
            long sum=0;
            for(int i=0;i<m;i++)
            sum+=ans[0][i];
            out.println(sum%mod);
        }
        out.flush();
    }
}