CF802A Heidi and Library (easy)
Description
Your search for Heidi is over – you finally found her at a library, dressed up as a human. In fact, she has spent so much time there that she now runs the place! Her job is to buy books and keep them at the library so that people can borrow and read them. There are $ n $ different books, numbered $ 1 $ through $ n $ .
We will look at the library's operation during $ n $ consecutive days. Heidi knows in advance that on the $ i $ -th day ( $ 1
Input Format
The first line of input will contain two integers $ n $ and $ k $ ( $ 1
Output Format
On a single line print the minimum cost of buying books at the store so as to satisfy all requests.
Explanation/Hint
In the first test case, Heidi is able to keep all books forever. Therefore, she only needs to buy the book $ 1 $ before the first day and the book $ 2 $ before the second day.
In the second test case, she can only keep one book at a time. Therefore she will need to buy new books on the first, second and fourth day.
In the third test case, before buying book $ 3 $ on the third day, she must decide which of the books $ 1 $ and $ 2 $ she should get rid of. Of course, she should keep the book $ 1 $ , which will be requested on the fourth day.