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.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeSet;


public class Main {

	static class Task {
		
		int NN = 200005;
		int MOD = 1000000007;
		int INF = 2000000000;
		long INFINITY = 2000000000000000000L;
		
		class Matrix {
			long [][] a;
			int n, m;
			public Matrix(int n, int m) {
				a = new long[n][m];
				this.n = n;this.m = m;
			}
			
			public Matrix(long [][] d) {
				this.n= d.length;
				this.m = d[0].length;
				a = new long[n][m];
				for(int i=0;i<n;++i) {
					for(int j=0;j<m;++j) {
						a[i][j] = d[i][j];
					}
				}
			}
			
			public Matrix multiply(Matrix mat) {
				if(this.m != mat.n)
					return null;
				Matrix res = new Matrix(this.n, mat.m);
				for(int i=0;i<this.n;++i) {
					for(int j=0;j<mat.m;++j) {
						long total = 0;
						for(int k=0;k<this.m;++k) {
							total = (total + this.a[i][k]*mat.a[k][j]) % MOD;
						}
						res.a[i][j] = total;
					}
				}
				return res;
			}
			
			public Matrix unit() {
				Matrix res = new Matrix(this.n, this.m);
				for(int i=0;i<n;++i) {
					for(int j=0;j<m;++j) {
						if(i == j) {
							res.a[i][j] = 1;
						} else {
							res.a[i][j] = 0;
						}
					}
				}
				return res;
			}
			
			public Matrix clone() {
				Matrix res = new Matrix(this.n, this.m);
				for(int i=0;i<n;++i) {
					for(int j=0;j<m;++j) {
						res.a[i][j] = this.a[i][j];
					}
				}
				return res;
			}
			
			public Matrix pow(long exponent) {
				Matrix ret = this.unit(), sq = this.clone();
				while(exponent > 0) {
					if(exponent%2 != 0) {
						ret = ret.multiply(sq);
					}
					exponent >>= 1;
					sq = sq.multiply(sq);
				}
				return ret;
			}
			
		}
		
		public void solve(InputReader in, PrintWriter out) {
			long N = in.nextLong(), M = in.nextLong();
			if(N < M) {
				out.println(1);return;
			}
			long [][] a = new long[(int)M][1];
			for(int j=0;j<(int)M;++j) {
				a[j][0] = 1;
			}
			Matrix P = new Matrix(a);
			long [][] b = new long[(int)M][(int)M];
			for(int i=0;i<M;++i) {
				for(int j=0;j<M;++j) {
					if(i == 0) {
						if(j == 0 || j == M - 1) {
							b[i][j] = 1;
						} else {
							b[i][j] = 0;
						}
					} else {
						if(i == j + 1) {
							b[i][j] = 1;
						} else {
							b[i][j] = 0;
						}
					}
				}
			}
			Matrix Q = new Matrix(b);
			Matrix ans = Q.pow(N - M + 1L).multiply(P);
			out.println(ans.a[0][0]);
		}
	}
	
	static void prepareIO(boolean isFileIO) {
		//long t1 = System.currentTimeMillis();
		Task solver = new Task();
		// Standard IO
		if(!isFileIO) { 
			InputStream inputStream = System.in;
	        OutputStream outputStream = System.out;
	        InputReader in = new InputReader(inputStream);
	        PrintWriter out = new PrintWriter(outputStream);
	        solver.solve(in, out);
	        //out.println("time(s): " + (1.0*(System.currentTimeMillis()-t1))/1000.0);
	        out.close();
		}
        // File IO
		else {
			String IPfilePath = System.getProperty("user.home") + "/Downloads/ip.in";
	        String OPfilePath = System.getProperty("user.home") + "/Downloads/op.out";
	        InputReader fin = new InputReader(IPfilePath);
	        PrintWriter fout = null;
	        try {
				fout = new PrintWriter(new File(OPfilePath));
			} catch (FileNotFoundException e) {
				e.printStackTrace();
			}
	        solver.solve(fin, fout);
	        //fout.println("time(s): " + (1.0*(System.currentTimeMillis()-t1))/1000.0);
	        fout.close();
		}
	}
	
	public static void main(String[] args) {
        prepareIO(false);
	}
	
	static class InputReader {
        public BufferedReader reader;
        public StringTokenizer tokenizer;

        public InputReader(InputStream stream) {
            reader = new BufferedReader(new InputStreamReader(stream), 32768);
            tokenizer = null;
        }
        
        public InputReader(String filePath) {
        	File file = new File(filePath);
            try {
				reader = new BufferedReader(new FileReader(file));
			} catch (FileNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
            tokenizer = null;
        }
        
        public String nextLine() {
        	String str = "";
        	try {
				str = reader.readLine();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
        	return str;
        }
        
        public String next() {
            while (tokenizer == null || !tokenizer.hasMoreTokens()) {
                try {
                    tokenizer = new StringTokenizer(reader.readLine());
                } catch (IOException e) {
                    throw new RuntimeException(e);
                }
            }
            return tokenizer.nextToken();
        }

        public int nextInt() {
            return Integer.parseInt(next());
        }

        public long nextLong() {
            return Long.parseLong(next());
        }

        public double nextDouble() {
        	return Double.parseDouble(next());
        }
        
    }

}