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;

typedef long long ll;

int N, K;
ll mod = 1000000007;
vector<int> V;
ll dp[2][200010];
ll tmp[2][200010];

int main()
{
    cin >> N >> K;


    for(int i = 1; i * i <= N; i++)
    {
        V.push_back(i);
        V.push_back(N / i);
    }

    sort(V.begin(), V.end());
    V.erase(unique(V.begin(), V.end()), V.end());

    dp[1][0] = 1;
    for(int i = 0; i < 200010; i++)tmp[1][i] = 1;
    for(int i = 0; i < K; i++)
    {
        for(int j = 0; j < V.size(); j++)
        {
            dp[i % 2][j] = tmp[1 - i % 2][(int)(V.size()) - 1 - j] *
                           (V[j] - (j - 1 >= 0 ? V[j - 1] : 0)) % mod;
            if(j == 0)tmp[i % 2][j] = dp[i % 2][j];
            else tmp[i % 2][j] = (tmp[i % 2][j - 1] + dp[i % 2][j]) % mod;
        }
    }

    cout << tmp[1 - K % 2][(int)(V.size()) - 1] << endl;

    return 0;
}