def comb(n, k, mod=10 ** 9 + 7): denominator = 1 numerator = 1 for i in range(1, k + 1): denominator = denominator * i % mod for i in range(n - k + 1, n + 1): numerator = numerator * i % mod return numerator * pow(denominator, mod - 2, mod) % mod def main(): boxes, colors = map(int, input().split()) mod = 10 ** 9 + 7 answer = 1 for i in range(colors): answer = (answer * (boxes - i)) % mod denominator = 1 for i in range(1, boxes - colors - 1): denominator = (denominator * i) % mod numerator = 1 for i in range(colors + 1, boxes): numerator = (numerator * i) % mod answer = (answer * pow(denominator, mod - 2, mod) * numerator) % mod print(answer) if __name__ == '__main__': main()