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.15.1) (judge verdict: Accepted)

#[allow(unused_macros)]
macro_rules! input {
    (source = $s:expr, $($r:tt)*) => {
        let mut iter = $s.split_whitespace();
        let mut next = || { iter.next().unwrap() };
        input_inner!{next, $($r)*}
    };
    ($($r:tt)*) => {
        let stdin = std::io::stdin();
        let mut bytes = std::io::Read::bytes(std::io::BufReader::new(stdin.lock()));
        let mut next = move || -> String{
            bytes
                .by_ref()
                .map(|r|r.unwrap() as char)
                .skip_while(|c|c.is_whitespace())
                .take_while(|c|!c.is_whitespace())
                .collect()
        };
        input_inner!{next, $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! input_inner {
    ($next:expr) => {};
    ($next:expr, ) => {};

    ($next:expr, $var:ident : $t:tt $($r:tt)*) => {
        let $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };

    ($next:expr, mut $var:ident : $t:tt $($r:tt)*) => {
        let mut $var = read_value!($next, $t);
        input_inner!{$next $($r)*}
    };
}

#[allow(unused_macros)]
macro_rules! read_value {
    ($next:expr, ( $($t:tt),* )) => {
        ( $(read_value!($next, $t)),* )
    };

    ($next:expr, [ $t:tt ; $len:expr ]) => {
        (0..$len).map(|_| read_value!($next, $t)).collect::<Vec<_>>()
    };

    ($next:expr, chars) => {
        read_value!($next, String).chars().collect::<Vec<char>>()
    };

    ($next:expr, usize1) => {
        read_value!($next, usize) - 1
    };

    ($next:expr, $t:ty) => {
        $next().parse::<$t>().expect("Parse error")
    };
}

#[allow(unused_macros)]
macro_rules! debug {
    ($($a:expr),*) => {
        #[cfg(debug_assertions)]
        writeln!(&mut std::io::stderr(), concat!("[DEBUG] ", $(stringify!($a), "={:?} "),*), $($a),*);
    }
}

#[allow(unused_imports)]
use std::cmp::{min, max};

#[allow(unused_imports)]
use std::io::Write;
const MOD: usize = 1e9 as usize + 7;

fn main() {
    input!{
      n: usize,
      k: usize,
    }
    let rn = (n as f64).sqrt() as usize;

    let mut lus = vec![0; rn+1];
    for i in (1..rn+1).rev() {
        let upper = n/i;
        let lower = max(n/(i+1) + 1, rn+1);
        if lower <= upper {
            lus[i] = upper - lower + 1;
            // debug!(i, lower, upper);
        }
    }

    let mut dp1 = vec![vec![0; rn+2]; k];
    let mut dp2 = vec![vec![0; rn+2]; k];

    for j in 1..rn+1 {
        dp1[0][j] = 1;
        if lus[j] > 0 {
            dp2[0][j] = 1;
        }
    }
    // debug!(dp1[0]);
    // debug!(dp2[0]);

    for i in 0..k-1 {
        let mut acm = vec![0; rn+2];
        for j in 1..rn+1 {
            acm[j+1] = acm[j] + dp1[i][j];
            acm[j+1] %= MOD;
        }

        let mut acm2 = vec![0; rn+2];
        for j in (1..rn+1).rev() {
            acm2[j-1] = acm2[j] + dp2[i][j] * lus[j] % MOD;
            acm2[j-1] %= MOD;
        }


        for j in 1..rn+1 {
            dp1[i+1][j] += acm[rn+1];
            dp1[i+1][j] %= MOD;
            dp1[i+1][j] += acm2[j-1];
            dp1[i+1][j] %= MOD;

            dp2[i+1][j] += acm[j+1];
            dp2[i+1][j] %= MOD;
        }
    }

    // debug!(lus);
    // for i in 0..k {
    //     debug!(dp1[i]);
    //     debug!(dp2[i]);
    // }

    let mut ans = 0;
    for i in 1..rn+1 {

        ans += dp1[k-1][i];
        ans %= MOD;

        ans += dp2[k-1][i] * lus[i] % MOD;
        ans %= MOD;
    }
    println!("{}", ans);
}