#P2059. Circle Elimination Game Winning Probabilities

    ID: 15341 Type: Default 1000ms 256MiB

Circle Elimination Game Winning Probabilities

Circle Elimination Game Winning Probabilities

There are (N) players sitting in a circle, numbered from (1) to (N) in clockwise order. The game proceeds in rounds. In the first round the dealer is player (1). In each round, the current dealer picks a card uniformly at random from a deck of (M) cards. Suppose the card shows the number (X). Then the dealer reveals the card to everyone and, starting from the dealer (who is counted as the first person), counts (X) players in clockwise order; the (X^{th}) player is executed (removed from the game). The used card is then returned to the deck and the deck is shuffled. The next round begins with the player immediately clockwise to the executed player serving as the new dealer. After (N-1) rounds only one player remains and is declared the winner. Given (N), (M) and the numbers on the cards, compute the winning probability for each player.

inputFormat

The first line contains two integers (N) and (M) (the number of players and cards respectively). The second line contains (M) integers representing the numbers on the cards.

outputFormat

Output (N) lines. The (i^{th}) line should contain a floating-point number with six digits after the decimal point, representing the winning probability of player (i) (players are numbered from 1 to (N)).

sample

2 1
1
0.000000

1.000000

</p>