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>
#pragma GCC optimize("-O3")
using namespace std;
template <typename T1, typename T2>
ostream& operator<<(ostream& os, pair<T1, T2> p) {
  cout << "(" << p.first << ", " << p.second << ")";
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, vector<T>& vec) {
  os << "{";
  for (int i = 0; i < vec.size(); i++)
    os << vec[i] << (i + 1 == vec.size() ? "" : ", ");
  os << "}";
  return os;
}
template <typename T>
ostream& operator<<(ostream& os, set<T>& st) {
  cout << "{";
  for (auto itr = st.begin(); itr != st.end(); itr++)
    cout << *itr << (next(itr) != st.end() ? ", " : "");
  cout << "}";
  return os;
}
template <typename T1, typename T2>
ostream& operator<<(ostream& os, map<T1, T2> mp) {
  cout << "{";
  for (auto itr = mp.begin(); itr != mp.end(); itr++)
    cout << "(" << (itr->first) << ", " << (itr->second) << ")"
         << (next(itr) != mp.end() ? "," : "");
  cout << "}";
  return os;
}
void dump_func() { cout << endl; }
template <class Head, class... Tail>
void dump_func(Head&& head, Tail&&... tail) {
  cout << head;
  if (sizeof...(Tail) == 0) {
    cout << " ";
  } else {
    cout << ", ";
  }
  dump_func(std::move(tail)...);
}
template <class T>
inline bool chmax(T& a, T const& b) {
  if (a >= b) return false;
  a = b;
  return true;
}
template <class T>
inline bool chmin(T& a, T const& b) {
  if (a <= b) return false;
  a = b;
  return true;
}
void _main();
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  _main();
  return 0;
}
using ll = long long;
using P = pair<int, int>;
using Pl = pair<ll, ll>;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
const int mod = 1e9 + 7, INF = 1 << 29;
const double EPS = 1e-5, PI = 3.1415926535897932384626;
const ll lmod = 1e9 + 7, LINF = 1LL << 59;
template <int MOD>
struct ModInt {
  static const int Mod = MOD;
  unsigned x;
  ModInt() : x(0) {}
  ModInt(signed sig) { x = sig < 0 ? sig % MOD + MOD : sig % MOD; }
  ModInt(signed long long sig) { x = sig < 0 ? sig % MOD + MOD : sig % MOD; }
  int get() const { return (int)x; }
  ModInt& operator+=(ModInt that) {
    if ((x += that.x) >= MOD) x -= MOD;
    return *this;
  }
  ModInt& operator-=(ModInt that) {
    if ((x += MOD - that.x) >= MOD) x -= MOD;
    return *this;
  }
  ModInt& operator*=(ModInt that) {
    x = (unsigned long long)x * that.x % MOD;
    return *this;
  }
  ModInt& operator/=(ModInt that) { return *this *= that.inverse(); }
  ModInt operator+(ModInt that) const { return ModInt(*this) += that; }
  ModInt operator-(ModInt that) const { return ModInt(*this) -= that; }
  ModInt operator*(ModInt that) const { return ModInt(*this) *= that; }
  ModInt operator/(ModInt that) const { return ModInt(*this) /= that; }
  ModInt inverse() const {
    long long a = x, b = MOD, u = 1, v = 0;
    while (b) {
      long long t = a / b;
      a -= t * b;
      std::swap(a, b);
      u -= t * v;
      std::swap(u, v);
    }
    return ModInt(u);
  }
  bool operator==(ModInt that) const { return x == that.x; }
  bool operator!=(ModInt that) const { return x != that.x; }
  ModInt operator-() const {
    ModInt t;
    t.x = x == 0 ? 0 : Mod - x;
    return t;
  }
};
template <int MOD>
ostream& operator<<(ostream& st, const ModInt<MOD> a) {
  st << a.get();
  return st;
};
template <int MOD>
ModInt<MOD> operator^(ModInt<MOD> a, unsigned long long k) {
  ModInt<MOD> r = 1;
  while (k) {
    if (k & 1) r *= a;
    a *= a;
    k >>= 1;
  }
  return r;
}
template <typename T, int FAC_MAX>
struct Comb {
  vector<T> fac, ifac;
  Comb() {
    fac.resize(FAC_MAX, 1);
    ifac.resize(FAC_MAX, 1);
    for (int i = 1; i < FAC_MAX; i++) fac[i] = fac[i - 1] * i;
    ifac[FAC_MAX - 1] = T(1) / fac[FAC_MAX - 1];
    for (int i = FAC_MAX - 2; i >= 1; i--) ifac[i] = ifac[i + 1] * T(i + 1);
  }
  T aPb(int a, int b) {
    if (b < 0 || a < b) return T(0);
    return fac[a] * ifac[a - b];
  }
  T aCb(int a, int b) {
    if (b < 0 || a < b) return T(0);
    return fac[a] * ifac[a - b] * ifac[b];
  }
  T nHk(int n, int k) {
    if (n == 0 && k == 0) return T(1);
    if (n <= 0 || k < 0) return 0;
    return aCb(n + k - 1, k);
  }
};
using mint = ModInt<int(1e9 + 7)>;
using vm = vector<mint>;
template <class T>
struct Matrix {
  vector<vector<T>> dat;
  Matrix(signed N) : dat(N, vector<T>(N)){};
  Matrix(const vector<vector<T>>& dat) : dat(dat){};
};
template <class T>
Matrix<T> operator*(Matrix<T>& a, Matrix<T>& b) {
  int N = a.dat.size();
  int x, y, z;
  Matrix<T> res(N);
  for (int x = 0; x < N; x++)
    for (int z = 0; z < N; z++)
      for (int y = 0; y < N; y++) {
        res.dat[x][y] += a.dat[x][z] * b.dat[z][y];
      }
  return res;
}
template <class T>
Matrix<T> operator^(Matrix<T> a, signed long long k) {
  assert(k >= 0);
  int N = a.dat.size();
  Matrix<T> res(N);
  for (int i = 0; i < N; i++) res.dat[i][i] = 1;
  while (k) {
    if (k & 1) res = a * res;
    a = a * a;
    k >>= 1;
  }
  return res;
}
void _main() {
  ll N, M;
  cin >> N >> M;
  if (N - M + 1 < 0) {
    cout << "1" << endl;
    return;
  }
  Matrix<mint> A(M);
  A.dat[0][0] = 1;
  A.dat[0][M - 1] = 1;
  for (int i = 0; i < M - 1; i++) A.dat[i + 1][i] = 1;
  auto An = A ^ (N - M + 1);
  mint ans(0);
  for (int i = 0; i < M; i++) ans += An.dat[0][i];
  cout << ans << endl;
}
