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 Ruby (2.3.3) (judge verdict: Accepted)

str = gets.split
N,K = str[0].to_i, str[1].to_i
mod = 1000000007

a = Array.new(0)
b = Array.new(0)
size = 0

i = 1
while i <= N/i
    a.push(i)
    b.push(N/i)
    i += 1
end
i = 0
size = a.size
if a[a.size-1] == b[b.size-1]
    i += 1
end
while i < size
    a.push(b[size-1-i])
    b.push(a[size-1-i])
    i += 1
end

c = Array.new(a.size,1)
for x in 1...c.size do
    c[x] = a[x] - a[x-1]
end

d = Array.new(2){Array.new(a.size)}
for x in 0...a.size do
    d[0][x] = a[x]
end
for x in 1...K do
    x0 = x%2
    x1 = (x-1)%2
    d[x0][0] = d[x1][a.size-1]
    for y in 1...a.size do
        d[x0][y] = (d[x0][y-1] + d[x1][a.size-1-y] * c[y]) % mod
    end
end

puts d[(K-1)%2][a.size-1]