Under construction

Still being built. Things may change

MatKor Cup Seat Arrangement

Time limit2sMemory limit1024 MB

Summary
Given N participants and M seats, find for each i from 0 to N the probability that exactly i participants are predicted to sit in their assigned seat.
Level

Medium6 of 10

Topics
Combinatorics, Math
Solved
No attempts yet

Problem

This MatKor Cup has NN participants in total, and the contest hall has MM seats. Jongwoo assigned each of the NN participants a different seat in advance. Dongwoo asked Jongwoo how the seats were assigned.

Jongwoo would not simply tell him. Instead, he asked Dongwoo to predict the seat of each of the NN participants. Dongwoo chose NN different seats out of the MM seats, then predicted the seat of each participant.

For each ii, find the probability that exactly ii of the NN predicted participants were predicted to sit in the same seat that Jongwoo assigned to them.

Jongwoo and Dongwoo assign and predict seats with equal probability over all possible cases.

Input

The first line contains the number of participants and the number of seats, NN and MM (1≤N≤M≤5 000 0001\le N\le M\le 5\,000\,000), separated by a space.

Output

Print the answer on a single line modulo 109+710^9+7. Print N+1N+1 numbers, from i=0i=0 to i=Ni=N, separated by spaces. Note that you must print all N+1N+1 values, from 0 to NN, separated by spaces.

Let pq\frac{p}{q} be an irreducible fraction with p≥0p\ge 0, q>0q>0, and gcd⁡(p,q)=1\gcd(p,q)=1. Its value modulo MM is p⋅q−1(modM)p\cdot q^{-1} \pmod M, where q−1q^{-1} is the modular multiplicative inverse of qq modulo MM, meaning q⋅q−1≡1(modM)q\cdot q^{-1}\equiv 1 \pmod M. If the fraction is an integer, then q=q−1=1q=q^{-1}=1, so the value is p(modM)p \pmod M.

It can be proven that under the given conditions, each probability is an integer or a rational number whose denominator is not a multiple of 109+710^9+7.

Examples5

  1. Example 1

    Input
    1 1
    
    Expected output
    0 1
    
  2. Example 2

    Input
    1 2
    
    Expected output
    500000004 500000004
    
  3. Example 3

    Input
    2 2
    
    Expected output
    500000004 0 500000004
    
  4. Example 4

    Input
    2 3
    
    Expected output
    500000004 333333336 166666668
    
  5. Example 5

    Input
    2 4
    
    Expected output
    583333338 333333336 83333334