Under construction

Still being built. Things may change

E(LCS⁡)\mathbb{E}\left(\operatorname{LCS}\right)

Time limit1sMemory limit1024 MB

Summary
Given N and M, find for each K from 1 to N the expected LCS length of M sequences built by random record draws from 1 to K, modulo 1e9+7.
Level

Hard9 of 10

Topics
Probability, Combinatorics, Math
Solved
No attempts yet

Problem

Geunhyeong attends Soongsil University and is also a member of the MatKor club at Korea University. He took the seminar run by MatKor titled <Solve All the Famous LCS Series>.

Geunhyeong wondered whether adding LCS to the number sequence game played by the SCCC club at Soongsil University would be fun. The game works as follows. First, pick a positive integer KK. Then each of the MM members who take part performs the following independently.

  • A blank sheet of paper is given. Repeat the steps below until KK is written on the sheet.
    • Draw one integer from 1 to KK inclusive, each with equal probability.
    • If the drawn number is larger than every number already on the sheet, write it at the end.

After the game ends, each of the MM members holds one sequence of length at most KK. Call these sequences A_1,A_2,⋯ ,A_MA\_1,A\_2,\cdots ,A\_M.

Geunhyeong wants the values of f(1,M),f(2,M),⋯ ,f(N,M)f(1,M), f(2,M), \cdots, f(N,M), where f(K,M)f(K,M) is the expected length of LCS⁡(A_1,A_2,⋯ ,A_M)\operatorname{LCS}(A\_1,A\_2,\cdots ,A\_M). Help him find them.

Here LCS⁡(A_1,A_2,⋯ ,A_M)\operatorname{LCS}(A\_1,A\_2,\cdots ,A\_M) is the longest common subsequence of all A_iA\_i. A subsequence is obtained by deleting zero or more elements from a sequence without changing the order of the remaining elements.

Input

The first line contains two positive integers N(1≤N≤106)N(1\le N\le 10^6) and M(1≤M≤1018)M(1\le M\le 10^{18}), separated by a space.

Output

Print the expected lengths f(1,M),f(2,M),⋯ ,f(N,M)f(1,M), f(2,M), \cdots, f(N,M) on the first line, separated by spaces, each reduced modulo 109+710^9+7.

For an irreducible fraction pq(p≥0,q>0,gcd⁡(p,q)=1)\frac{p}{q}(p\ge 0,q>0,\gcd(p,q) =1), its value modulo MM is defined as p⋅q−1(modM)p\cdot q^{-1}\pmod M, where q−1q^{-1} is the integer satisfying q⋅q−1≡1(modM)q\cdot q^{-1}\equiv 1\pmod M, that is, the modular multiplicative inverse of qq modulo MM. If the value is an integer, then q=q−1=1q=q^{-1}=1, so the result is p(modM)p\pmod M.

Under the given constraints, the expected value is either an integer or a rational number whose denominator is not a multiple of 109+710^9+7. This can be proven.

Examples3

  1. Example 1

    Input
    1 1
    
    Expected output
    1
    
  2. Example 2

    Input
    2 1
    
    Expected output
    1 500000005
    
  3. Example 3

    Input
    10 987654326925925926
    
    Expected output
    1 2 3 4 5 6 7 8 9 10