Favorite Arrays 2

Count length-N arrays with entries in 1..K where no adjacent pair has A > B with A divisible by B, modulo 1e9+7.

Hard8Dynamic programmingNumber theoryPrefix sumMathNo attempts yetTime limit2sMemory limit512 MB

Problem

Seonggwan likes every array that satisfies all of the following conditions.

  • The length of the array is NN.
  • Every element of the array is an integer between 11 and KK, inclusive.
  • If two adjacent elements are AA and BB in that order, then ABA \le B or AmodB0A \bmod B \ne 0.

For example, when N=4N = 4 and K=7K = 7, the array [1,7,7,2][1, 7, 7, 2] is one that Seonggwan likes. Its three adjacent pairs satisfy 171 \le 7, 777 \le 7, and 7mod207 \bmod 2 \ne 0.

Given NN and KK, write a program that counts the arrays Seonggwan likes.

Input

The first line contains NN and KK, separated by a space. (1N500001 \le N \le 50000, 1K500001 \le K \le 50000)

Output

On the first line, print the number of arrays Seonggwan likes, modulo 1,000,000,007.