func_code_string: #include <bits/stdc++.h>   using namespace std;   long long n;   int m;   const long long mod = 1e9 + 7;   struct Mat {     long long mat[111][111];   } st, ed;   long long stt[111][111];   void init() {     memset(stt, 0, sizeof(stt));     stt[0][0] = stt[0][m - 1] = 1;     for (int i = 1; i < m; ++i) stt[i][i - 1] = 1;     for (int i = 0; i < m; ++i)       for (int j = 0; j < m; ++j) st.mat[i][j] = stt[i][j];   }   Mat mul(Mat a, Mat b) {     Mat ret;     for (int i = 0; i < m; ++i)       for (int j = 0; j < m; ++j) {         ret.mat[i][j] = 0;         for (int k = 0; k < m; ++k)           (ret.mat[i][j] += a.mat[i][k] * b.mat[k][j] % mod) %= mod;       }     return ret;   }   Mat pow(Mat a, long long b) {     Mat ret;     memset(ret.mat, 0, sizeof(ret.mat));     for (int i = 0; i < m; ++i) ret.mat[i][i] = 1;     while (b) {       if (b & 1) ret = mul(ret, a);       a = mul(a, a);       b >>= 1;     }     return ret;   }   int main() {     cin >> n >> m;     if (n < m) return 0 * puts( 1 );     init();     ed = pow(st, n - m + 1);     long long ans = 0;     for (int i = 0; i < m; ++i) (ans += ed.mat[0][i]) %= mod;     cout << ans << (  n );   }   