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: Wrong Answer)

MOD = 10 ** 9 + 7
NN, KK = gets.chomp.split.map(&:to_i)

k_v = {}
v_k = {}

SQRT_NN = Math.sqrt(NN).to_i

SQRT_NN.times do |i|
  x = (NN/(i+1))
  k_v[x] = 1
  v_k[i+1] = x
end

keys = v_k.keys.sort.reverse
keys.each_cons(2) do |i, j|
  k_v[j] = v_k[j] - v_k[i]
end

ans = 0

next_values = Hash.new(0)
current_values = Hash.new(0)
k_v.each { |k, v| next_values[k] = v }

(KK - 2).times do
  current_values = next_values
  next_values = Hash.new(0)
  current_values.each do |k, v|
    tmp = 0
    k_v.each do |k1, v1|
      if (tmp + v1) <= k
        tmp += v1
        next_values[k1] += (v1 * v)
      else
        tmp += k - tmp
        next_values[k1] += ((k - tmp))
      end
      break if tmp == k
    end
  end
end

next_values.each do |k, v|
  ans += (k * v)%MOD
end

p ans%MOD



# k = 1　の時 1..NのNパターンがある。
# k=2のときは以下のhashでkey*valueのsumを取れば良い
# {
#  101=>1, # 相方が101種類あるものが1こ(1)
#   50=>1, # 相方が50種類あるものが1こ(2)
#   33=>1, # ...
#   25=>1,
#   20=>1,
#   16=>1,
#   14=>1,
#   12=>1,
#   11=>1,
#   10=>1,
#   1=>51,
#   2=>17,
#   3=>8,
#   4=>5,
#   5=>4,
#   6=>2,
#   7=>2,
#   8=>1,
#   9=>1
# }