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.
#include <bits/stdc++.h>
using namespace std;
namespace Flandre_Scarlet {
class Matrix {
 private:
  long long a[110][110];

 public:
  long long n;
  Matrix() {
    memset(a, 0, sizeof(a));
    n = 0;
  }
  Matrix(long long _n) {
    memset(a, 0, sizeof(a));
    n = _n;
  }
  Matrix(long long _n, long long _x) {
    _x %= ((long long)1e9 + 7);
    n = _n;
    for (long long i = 0; i < 110; ++i) {
      for (long long j = 0; j < 110; ++j) {
        a[i][j] = _x;
      }
    }
  }
  long long* operator[](long long i) { return *(a + i); }
  void Set(long long x) {
    x %= ((long long)1e9 + 7);
    for (long long i = 0; i < 110; ++i) {
      for (long long j = 0; j < 110; ++j) {
        a[i][j] = x;
      }
    }
  }
  void Identity() {
    memset(a, 0, sizeof(a));
    for (long long i = 0; i < 110; ++i) {
      a[i][i] = 1;
    }
  }
};
Matrix operator*(Matrix x, Matrix y) {
  Matrix ans(x.n, 0);
  long long n = ans.n;
  for (long long i = 1; i <= n; ++i)
    for (long long j = 1; j <= n; ++j) {
      if (x[i][j]) {
        for (long long k = 1; k <= n; ++k) {
          ans[i][k] += x[i][j] * y[j][k] % ((long long)1e9 + 7);
          if (ans[i][k] >= ((long long)1e9 + 7))
            ans[i][k] -= ((long long)1e9 + 7);
        }
      }
    }
  return ans;
}
Matrix operator^(Matrix x, long long p) {
  Matrix ans(x.n, 1);
  ans.Identity();
  while (p) {
    if (p & 1) ans = ans * x;
    x = x * x, p >>= 1;
  }
  return ans;
}
long long n, m;
void Input() { cin >> n >> m; }
void Soviet() {
  if (n < m) {
    puts("1");
    return;
  }
  Matrix Trans(m, 0);
  Matrix Init(m, 0);
  for (long long i = 2; i <= m; ++i) {
    Init[i][1] = 1;
  }
  Init[1][1] = 2;
  Trans[1][1] = Trans[1][m] = 1;
  for (long long i = 2; i <= m; ++i) Trans[i][i - 1] = 1;
  Matrix Answer = (Trans ^ (n - m)) * Init;
  printf("%lld\n", Answer[1][1]);
}
void IsMyWife() {
  Input();
  Soviet();
}
}  // namespace Flandre_Scarlet
int main() {
  Flandre_Scarlet::IsMyWife();
  getchar();
  getchar();
  return 0;
}
