For this Question: Taro loves colours. Today she is interested in painting bricks. N bricks are arranged in a line. She needs to paint them using K colours. She does not want two adjacent bricks to be painted in same colour. Can you help her find the number of ways she can colour the given N bricks.

As the answer can be large print it modulo 1000000007.

Property: (a*b)%c = ((a%c)*(b%c))%c.The first and the only line of input contains 2 integers N and K.

Constraints
1 <= N <= 1000
2 <= K <= 1000Output a single integer, the number of ways in which she can colour the bricks modulo 1000000007.Sample Input
2 2

Sample Output
2

Explanation: Let the colours be 1 and 2. The ways of colouring the bricks are "1 2" or "2 1".

Sample Input:
1 10

Sample Output:
10, I have written this Solution Code: k= list(map(int,input().split()))
res = k[1]
for _ in range(1,k[0]):
    res = (res*(k[1]-1))%1000000007
print(res), In this Programming Language: Python, Now tell me if this Code is compilable or not?