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 Rust (1.42.0) (judge verdict: Accepted)

use proconio::input;
#[allow(unused_imports)]
use proconio::marker::*;
#[allow(unused_imports)]
use std::cmp::*;
#[allow(unused_imports)]
use std::collections::*;
#[allow(unused_imports)]
use std::f64::consts::*;

#[allow(unused)]
const INF: usize = std::usize::MAX / 4;
#[allow(unused)]
const M: usize = 1000000007;

fn main() {
    input! {
        n: usize,
        k: usize,
    }

    let mut factors = vec![];
    for d in 1.. {
        if d * d > n {
            break;
        }
        factors.push(d);
        factors.push(n / d);
    }
    factors.sort();
    factors.dedup();
    let m = factors.len();

    let mut dp = vec![vec![0; m]; k];
    dp[0][0] = 1;
    for f in 1..m {
        dp[0][f] = factors[f] - factors[f - 1];
    }
    for i in 1..k {
        for j in 0..m {
            dp[i][j] = dp[i - 1][m - j - 1];
        }
        for j in (1..m).rev() {
            dp[i][j - 1] = (dp[i][j - 1] + dp[i][j]) % M;
        }
        for j in 1..m {
            dp[i][j] = dp[i][j] * (factors[j] - factors[j - 1]) % M
        }
    }

    let mut result = 0usize;
    for j in 0..m {
        result = (result + dp[k - 1][j]) % M;
    }
    println!("{}", result);
}