n,c = map(int,input().split()) a = list(map(int,input().split())) from collections import defaultdict d = defaultdict(int) for i in a: d[i] += 1 P = 10 ** 9 + 7 def f(c,k): if k > c:return 0 c -= 1 k -= 1 ans = 1 for i in range(k): ans = ans * (c - i) * pow(k - i,P-2,P) % P return ans ans = 0 for i in d: inv = pow(i,P-2,P) u = 1 for j in d: if j == i:continue t = (1 - j * inv) % P t = pow(t,P-2,P) t = pow(t,d[j],P) u = u * t % P v = pow(i,c,P) ans += (u * f(c,d[i]) - d[i]) * v ans %= P print(ans)