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: Accepted)

#include <bits/stdc++.h>
using namespace std;
#define ll long long

ll mod = 1e9+7;

int main(){
    ll N;
    ll K;
    cin >> N >> K;
    ll M = 32000;
    vector<ll> dp1(M+3, 0), dp2(M+3, 0);
    
    for (int i = 1; i < M; i++) {
        dp1[i] = i;
    }
    for (int i = 1; i < M; i++) {
        dp2[i] = (N/i)%mod;
    }
    
    
    for (ll i = 1; i < K; i++) {
        vector<ll> dp3(M+1, 0), dp4(M+1, 0);
        
        for (ll j = 1; j < M; j++) {
            dp3[j] = (dp3[j-1] + dp2[j])%mod;
        }
        
        dp4[M] = dp3[N/M];
        
        for (ll j = M-1; j >= 1; j--) {
            dp4[j] = (dp4[j+1] + dp1[j] * (N/j - (N/(j+1))) )%mod;
        }
        
        dp1 = dp3;
        dp2 = dp4;
        
    }
    
    cout << dp2[1] << endl;
    return 0;
}