Problem:
Score : 600 points

Problem Statement

Find the number of sequences of length K consisting of positive integers such that the product of any two adjacent elements is at most N, modulo 10^9+7.

Constraints

1\leq N\leq 10^9

1 2\leq K\leq 100 (fixed at 21:33 JST)

N and K are integers.

Input

Input is given from Standard Input in the following format:

N K

Output

Print the number of sequences, modulo 10^9+7.

Sample Input 1

3 2

Sample Output 1

5

(1,1), (1,2), (1,3), (2,1), and (3,1) satisfy the condition.

Sample Input 2

10 3

Sample Output 2

147

Sample Input 3

314159265 35

Sample Output 3

457397712

Solution in C++14 (GCC 5.4.1) (judge verdict: Wrong Answer)

#include <iostream>
#include <algorithm>
#include <vector>
#include <set>
#include <map>
#include <string>
#include <limits.h>
#include <float.h>
#include <numeric>
#include <queue>
#include <typeinfo>
#include <memory>


using namespace std;

typedef long long ll;
typedef tuple<int, int, int> T;

#define fs first
#define sc second

const ll mod = 1000000007;
ll fact[200200];
ll invfact[200200];

inline ll take_mod(ll a){
    return (a % mod + mod) % mod;
}

inline ll add(ll a, ll b){
    return take_mod(a+b);
}

inline ll sub(ll a, ll b){
    return take_mod(a-b);
}


inline ll mul(ll a, ll b){
    return take_mod(a * b);
}

inline ll pow(ll x, ll n){
    ll res = 1LL;
    while(n > 0){
        if(n & 1) res = mul(res, x);
        x = mul(x, x);
        n >>= 1;
    }
    return res;
}

ll mod_inv(ll x){
    return pow(x, mod-2);
}

// nは上限
void make_fact(ll n){
    fact[0] = 1;
    ll res = 1;
    for(int i = 1; i <= n; i++){
        fact[i] = res;
        res = mul(res, i+1);
    }
}

// nは上限
void make_invfact(ll n){
    invfact[0] = 1;
    invfact[n] = mod_inv(fact[n]);
    for(int i = n-1; i >= 1; i--){
        invfact[i] = mul(invfact[i + 1], i + 1);
    }
}

ll perm(ll n, ll k){
    return mul(fact[n], invfact[n-k]);
}

ll comb(ll n, ll k){
    return mul(mul(fact[n], invfact[n-k]), invfact[k]);
}

ll x[101000];
ll dp[100][101000];


int main(){
    ll N, K;
    cin >> N >> K;
    int k = 0;
    for(int i = 1; i * i <= N; i++){
        x[i] = N / i;
        k = i;
    }

    ll su = 0;
    ll num[101000];
    for(int i = 1; i * i <= N; i++){
        dp[0][i] = 1;
        dp[0][k+i] = x[i];
        su = add(su, dp[0][i]);
        su = add(su, dp[0][k+i]);
    }
    for(int i = 1; i * i <= N; i++){
        num[i] = 1;
        if(i == k){
            num[i+k] = x[i];
        }
        else {
            num[i + k] = x[i] - x[i + 1];
        }
    }


    for(int i = 1; i < K; i++){
        ll su_tmp = 0;
        ll su2 = 0;
        for(int j = 1; j * j <= N; j++){
            dp[i][j] = su;
            su2 = add(su2, dp[i-1][j]);
            dp[i][j+k] = su2 * num[j+k];
            su = sub(su, dp[i-1][j+k]);
            su_tmp = add(su_tmp, dp[i][j]);
            su_tmp = add(su_tmp, dp[i][j+k]);
        }
    }


    ll res = 0;
    for(int i = 1; i * i <= N; i++){
        res = add(res, dp[K-1][i]);
        res = add(res, dp[K-1][i+k]);
    }

    cout << res << endl;


    return 0;
}