405097: GYM101790 G Task distributor
Description
Every second the task distributor receives a new task. Tasks are numbered sequentially, starting from zero.
If the task number is not divided into K, then its execution on any server takes T seconds, otherwise it takes 2 × T seconds.
After receiving the task, the distributor immediately transfers it to one of the free servers. If there are no free servers at the time of the task's receipt, then a collapse occurs.
Initially, all servers are free. The server executing the task becomes free immediately when the task execution is finished.
What is the minimum number of servers needed to ensure that the collapse never occurs?
InputThe first and only line contains two integers T (1 ≤ T ≤ 1018) and K (1 ≤ K ≤ 1018).
OutputDisplay the minimum number of servers needed to ensure that the collapse never occurs.
ExamplesInput4 3Output
6Input
3 4Output
4Input
2 2Output
3Input
1 2Output
2