import sys MOD = 1000000007 def prod(a, b): return 0 if a < b else fac[a] * finv[a-b] % MOD def extgcd(a, b, x, y): if b > 0: res = extgcd(b, a % b, y, x) res[0] -= (a // b) * res[1] return [res[1], res[0]] else: return [1, 0] def mod_inverse(a, m): return (m + extgcd(a, m, 0, 0)[0] % m) % m if __name__ == '__main__': n, B = map(int, sys.stdin.readline().split()) cnt, inv, fac, finv = [0]*n, [0]*n, [0]*n, [0]*n for val in list(map(int, sys.stdin.readline().split())): cnt[val] += 1 fac[0] = fac[1] = 1 finv[0] = finv[1] = 1 inv[1] = 1 for i in range(2, n): inv[i] = MOD - inv[MOD % i] * (MOD // i) % MOD fac[i] = fac[i - 1] * i % MOD finv[i] = finv[i - 1] * inv[i] % MOD id, ad, ans, s, t, pl = 0, 0, B, 0, 0, B flag = False for i in range(n-1, -1, -1): if cnt[i] == 0: continue s = prod(id + cnt[i] - 1, cnt[i] - 1) * cnt[i] % MOD t = (s * B + prod(id + cnt[i] - 1, cnt[i])) % MOD if t > 0: ad = (ad + s * mod_inverse(t, MOD) % MOD) % MOD pl = pl * t % MOD else: if flag: pl = 0 else: flag = True pl = pl * s % MOD ans = ans * t % MOD id += cnt[i] print((ans * ad + (pl if flag else 0)) % MOD)