B = 10**9 + 7 n,m=map(int,input().split()) blanks = n - m blank1=1 blank2=1 for i in range(1, blanks+1): blank1 *= (n+1-i) % B blank2 *= (i) % B blank_p = int(blank1 / blank2) cp = 1 for i in range(1, m+1): cp *= i cp %= B print(cp*blank_p%B)