N, M = map(int, input().split()) mod = 10**9+7 for i in range(1, M+1): d, m = divmod(N, i) if i-m!=1: R=pow(d+1, m+1, mod)*pow(d, i-m-2, mod)*(d-1)%mod # R = (d+1)*(d-1)*pow(d, N-2, mod)%mod else: R=pow(d+1, m, mod)*pow(d, i-m, mod)%mod print(R)