403192: GYM101063 J The Keys

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

J. The Keystime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

Out of all science labs constructed by the GEMA mission on Mars, the DSL - Dangerous Species Lab is the most dangerous of them all. The laboratory is so dangerous that you have to go through N doors in succession to get to it. Each one of those doors can only be opened by one key di (notice, however, that there may be different doors that can be opened by the same key).

A nameless lazy biologist (we'll call him LB) from GEMA needs to open all those doors first thing in the morning, every day. He has all the keys necessary to open them, but he finds carrying all of them in his pockets too much of a mess.

To be more organized and lose the title of being a lazy biologist, LB purchased K key-chains and is planning to distribute all the keys among them. His plan of distribution is very simple. For each key, randomly choose a key-chain with uniform probability and put this key on it.

When opening the doors, LB will hold one key-chain and will keep the others in his pocket (initially all of them are in his pocket). Whenever he gets to a door that needs a key that is not on the key-chain he is holding, he will swap it with the key-chain that has this key. Getting the first key-chain from his pocket is not considered a swap.

You have to help LB and find what is the expected number of key-chain swaps he will have to do when opening the doors the next morning.

Input

Input begins with N and K (1 ≤ N ≤ 105, 1 ≤ K ≤ N), the number of doors and the number of key-chains. On the next line there are N numbers di (1 ≤ di ≤ 106), the identifier of the key that opens the i-th door.

Output

Output the expected number of swaps. Your answer will be considered correct if the absolute and relative error are less than 10 - 6.

ExamplesInput
3 3
1 2 3
Output
1.333333333
Input
1 1
2
Output
0.000000000
Input
5 2
1 2 3 2 1
Output
2.000000000

Source/Category

加入题单

上一题 下一题 算法标签: