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;
const double pi = 3.141592653589;
long long int mod = 1000000007;
long long int mod2 = 1000000009;
const long long int inf = 1e9;
const long long int inff = 9000000000000000000;
long double eps = 1e-9;
const long long int base1 = 304933;
const long long int base2 = 4395853;
long double power(long long int x, long long int y, long long int p) {
  long long int res = 1;
  x = x % p;
  while (y > 0) {
    if (y & 1) res = (res * x) % p;
    y = y >> 1;
    x = (x * x) % p;
  }
  return res;
}
long long int modInverse(long long int n, long long int p) {
  return power(n, p - 2, p);
}
long long int fac[1];
long long int invfac[1];
long long int ncr(long long int n, long long int r, long long int p) {
  if (r > n) return 0;
  if (r == 0) return 1;
  return (fac[n] * modInverse(fac[r], p) % p * modInverse(fac[n - r], p) % p) %
         p;
}
long long int log(long long int a, long long int b) {
  if (a == 1) return b;
  long long int ans = 0;
  while (b) {
    ans++;
    b /= a;
  }
  return ans - 1;
}
int is_prime[1];
int smallestfactor[1];
void sieve() {
  for (long long int i = 2; i <= 5000000; i++) {
    if (is_prime[i]) {
      for (long long int j = i * i; j <= 5000000; j += i) {
        if (is_prime[j] == 1) {
          is_prime[j] = 0;
          smallestfactor[j] = i;
        }
      }
    }
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int test = 1;
  while (test--) {
    long long int n, m;
    cin >> n >> m;
    if (n < m) {
      cout << 1;
      return 0;
    } else if (n == m) {
      cout << 2;
      return 0;
    }
    n -= m;
    long long int powers[60];
    powers[0] = 1;
    for (int i = 1; i < 60; i += 1) {
      powers[i] = 2 * powers[i - 1];
    }
    long long int matrix[m + 1][m + 1];
    long long int ans[m + 1][m + 1];
    for (int i = 0; i < m + 1; i += 1) {
      for (int j = 0; j < m + 1; j += 1) {
        matrix[i][j] = 0;
        ans[i][j] = 0;
      }
    }
    long long int matrix2[m + 1][m + 1];
    long long int ans2[m + 1][m + 1];
    for (int i = 0; i < m; i += 1) {
      matrix[i][i + 1] = 1;
      ans[i][i] = 1;
    }
    matrix[m][1] = 1;
    matrix[m][m] = 1;
    ans[m][m] = 1;
    for (int ii = 0; ii < 60; ii += 1) {
      if ((n & powers[ii]) != 0) {
        for (int i = 0; i < m + 1; i += 1) {
          for (int j = 0; j < m + 1; j += 1) {
            ans2[i][j] = ans[i][j];
            ans[i][j] = 0;
          }
        }
        for (int i = 0; i < m + 1; i += 1) {
          for (int j = 0; j < m + 1; j += 1) {
            for (int k = 0; k < m + 1; k += 1) {
              ans[i][j] += ans2[i][k] * matrix[k][j];
              ans[i][j] %= mod;
            }
          }
        }
      }
      for (int i = 0; i < m + 1; i += 1) {
        for (int j = 0; j < m + 1; j += 1) {
          matrix2[i][j] = 0;
        }
      }
      for (int i = 0; i < m + 1; i += 1) {
        for (int j = 0; j < m + 1; j += 1) {
          for (int k = 0; k < m + 1; k += 1) {
            matrix2[i][j] += matrix[i][k] * matrix[k][j];
            matrix2[i][j] %= mod;
          }
        }
      }
      for (int i = 0; i < m + 1; i += 1) {
        for (int j = 0; j < m + 1; j += 1) {
          matrix[i][j] = matrix2[i][j];
        }
      }
    }
    long long int finalans[m + 1][1];
    long long int ini[m + 1][1];
    for (int i = 0; i < m + 1; i += 1) {
      finalans[i][0] = 0;
      ini[i][0] = 1;
    }
    ini[m][0]++;
    for (int i = 0; i < m + 1; i += 1) {
      for (int j = 0; j < 1; j += 1) {
        for (int k = 0; k < m + 1; k += 1) {
          finalans[i][j] += ans[i][k] * ini[k][j];
          finalans[i][j] %= mod;
        }
      }
    }
    cout << finalans[m][0];
  }
  return 0;
}
