New-year tree
Medium
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
For decoration of the New-year tree Peter has in the order a garland from the n lamps and k of different paints for their painting. How many methods can he to do it, if he must no two identical colors be alongside?
Input
The amount of lamps is n, the amount of different paints is k (1 ≤ k, n ≤ 15).
Output
Print the number of painting ways. If Peter can not paint a garland after the described requirements, to show out -1.
Examples
Input #1
Answer #1
Submissions 12K
Acceptance rate 11%