N, M = map(int, input().split()) N -= 1 A = list(map(int, input().split())) + [0] mod = 10**9 + 7 comb = M + 1 ans = 0 now = 1 for i in range(N - 1, -1, -1): ans += (A[i] - A[i - 1]) * (comb - 1) ans %= mod comb *= (M + 1 + now) * pow(now + 1, mod - 2, mod) comb %= mod now += 1 print(ans)