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# (Mono 4.6.2.0) (judge verdict: Accepted)

using System;
using System.Collections.Generic;
class Program
    {
        public class Node
        {
            static void Main(string[] args)
            {
                long mod = 1000000007;
                string[] s = Console.ReadLine().Split(' ');
                long n = long.Parse(s[0]);
                int k = int.Parse(s[1]);

                long rootN = (long)Math.Sqrt(n);
                int arrSize = (int)rootN * 2;
                if (rootN * rootN == n) arrSize--;

                long[] arr = new long[arrSize + 1];
                for (int i=1; i<=rootN; i++)
                {
                    arr[i] = i;
                    arr[arrSize + 1 - i] = n / i;
                }

                long[] comb_add = new long[arrSize + 1];
                comb_add[1] = 1;

                for (int i=1; i<k; i++)
                {
                    //foreach(int x in comb_add) Console.Error.WriteLine(x);
                    long[] new_comb_add = new long[arrSize + 1];
                    long[] comb = new long[arrSize + 1];
                    for (int j = 1; j<=arrSize; j++)
                    {
                        comb[j] = comb[j - 1] + comb_add[j];
                        comb[j] %= mod;
                        //Console.Error.WriteLine(arr[j] + " " + comb[j]);
                    }
                    for (int j=1; j<=arrSize; j++)
                    {
                        long num = comb[j] * (arr[j] - arr[j - 1]) % mod;
                        new_comb_add[1] += num;
                        new_comb_add[1] %= mod;
                        if (j > 1)
                        {
                            new_comb_add[arrSize + 2 - j] -= num;
                            new_comb_add[arrSize + 2 - j] %= mod;
                        }
                    }
                    comb_add = new_comb_add;
                }
                long ans = 0;
                long c = 0;
                for(int i=1; i<=arrSize; i++)
                {
                    c += comb_add[i];
                    c %= mod;
                    //Console.Error.WriteLine(arr[i] + " " + c);
                    ans += c * (arr[i] - arr[i - 1]) % mod;
                    ans %= mod;
                }
                if (ans < 0) ans += mod;
                Console.WriteLine(ans);
                
                
            }
            
        }
    
    }
    //mcs Main.cs
    //mono Main.exe