Time

10:41:20
11 Feb 2012
ACM-ICPC Thailand Southern Region Programming Contest 2011
Left: 4 hours 19 minutes
End: 11.02.2012 15:00
Leader: Informatimukas
Five for week 22
Left: 11 hours 19 minutes
End: 11.02.2012 22:00
Leader: NuM
Version for print

New-year tree

prb23    For decoration of the New-year tree Peter has in the order a garland from the N lamps and Ê of different paints for their painting. How many methods can he to do it, if he must no 2 identical colors be alongside?


Specifications

   Input

    The amount of lamps is N, the amount of different paints is Ê. (1K, N ≤ 15).

   Output

   Amount of methods of painting. If Peter can not paint a garland after the described requirements, to show out -1.


Problem information

Time Limit: 1 seconds
Memory Limit: 64 MB
Balls for the passed test: 5
Complexity: 67% 81/249

Example

Example input

6 2

Example output

2


← "Mirror prime" numbers Problems Paint2D-Crack →