func_code_string: #include <bits/stdc++.h>   #pragma GCC optimize( O3 )   using namespace std;   const int N = 110031;   long long n, m;   vector<vector<long long> > one(int sz) {     vector<vector<long long> > ret;     ret.resize(sz);     for (int i = 0; i < ret.size(); i++) {       ret[i].resize(sz);       for (int j = 0; j < ret.size(); j++) {         ret[i][j] = (i == j);       }     }     return ret;   }   vector<vector<long long> > mult(vector<vector<long long> > a,                                   vector<vector<long long> > b) {     vector<vector<long long> > ret;     ret.resize(a.size());     for (int i = 0; i < ret.size(); i++) {       ret[i].resize(a.size());       for (int j = 0; j < ret.size(); j++) {         ret[i][j] = 0;       }     }     for (int k = 0; k < ret.size(); k++) {       for (int i = 0; i < a.size(); i++) {         for (int j = 0; j < b.size(); j++) {           ret[i][j] = (ret[i][j] + a[i][k] * b[k][j]);           ret[i][j] %= 1000000007;         }       }     }     return ret;   }   vector<vector<long long> > pw(vector<vector<long long> > a, long long b) {     if (b == 0) return one((int)a.size());     if (b % 2) return mult(a, pw(a, b - 1));     return pw(mult(a, a), b / 2);   }   vector<vector<long long> > dp;   int main() {     ios_base::sync_with_stdio(0);     cin >> n >> m;     dp.resize(m);     for (int i = 0; i < m; i++) {       dp[i].resize(m);     }     for (int i = 0; i < dp.size(); i++) {       for (int j = 0; j < dp.size(); j++) {         dp[i][j] = 0;       }     }     for (int i = 0; i < dp.size(); i++) {       dp[i][(i + 1) % m]++;     }     dp[0][0]++;     dp = pw(dp, n);     cout << dp[0][0] << endl;     return 0;   }   