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