n, k = list(map(int, input().split()))

a = list(map(int, input().split()))

mod = 10 ** 9 + 7

a.sort(reverse = True)



N = n+2

P = mod

inv_t = [0]+[1]

for i in range(2,N):

  inv_t += [inv_t[P % i] * (P - int(P / i)) % P]



base = 1

for item in range(n-k+1, n):

    base = (base * item) % mod

for i in range(1, k):

    base = (base * inv_t[i]) % mod

base2 = base



ans = 0

ans2  = 0

top = n - 1

for ai in a:

    if top < k-1:

        break

    if ai > 0:

        ans += base * ai

        ans %= mod

    else:

        ans2 += abs(base * ai)

        ans2 %= mod



    base = base * inv_t[top] * (top - k + 1)  % mod

    top -= 1



top = n-1

for ai in reversed(a):

    if top < k-1:

        break

    if ai > 0:

        ans2 += base2 * ai

        ans2 %= mod

    else:

        ans += abs(base2 * ai)

        ans %= mod

    base2 = base2 * inv_t[top] * (top - k + 1)  % mod

    top -= 1

print(((ans - ans2) % mod))

n, k = list(map(int, input().split()))

a = list(map(int, input().split()))

mod = 10 ** 9 + 7

a.sort(reverse = True)



N = n+2

P = mod

inv_t = [0]+[1]

for i in range(2,N):

  inv_t += [inv_t[P % i] * (P - int(P / i)) % P]



base = 1

for item in range(n-k+1, n):

    base = (base * item) % mod

for i in range(1, k):

    base = (base * inv_t[i]) % mod

base2 = base



ans = 0

top = n - 1

for ai in a:

    if top < k-1:

        break

    ans += base * ai

    ans %= mod



    base = base * inv_t[top] * (top - k + 1)  % mod

    top -= 1



top = n-1

for ai in reversed(a):

    if top < k-1:

        break

    ans -= base2 * ai

    ans %= mod

    base2 = base2 * inv_t[top] * (top - k + 1)  % mod

    top -= 1

print((ans % mod))

n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
mod = 10**9 + 7
a.sort(reverse=True)
N = n + 2
P = mod
inv_t = [0] + [1]
for i in range(2, N):
    inv_t += [inv_t[P % i] * (P - int(P / i)) % P]
base = 1
for item in range(n - k + 1, n):
    base = (base * item) % mod
for i in range(1, k):
    base = (base * inv_t[i]) % mod
base2 = base
ans = 0
ans2 = 0
top = n - 1
for ai in a:
    if top < k - 1:
        break
    if ai > 0:
        ans += base * ai
        ans %= mod
    else:
        ans2 += abs(base * ai)
        ans2 %= mod
    base = base * inv_t[top] * (top - k + 1) % mod
    top -= 1
top = n - 1
for ai in reversed(a):
    if top < k - 1:
        break
    if ai > 0:
        ans2 += base2 * ai
        ans2 %= mod
    else:
        ans += abs(base2 * ai)
        ans %= mod
    base2 = base2 * inv_t[top] * (top - k + 1) % mod
    top -= 1
print(((ans - ans2) % mod))

n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
mod = 10**9 + 7
a.sort(reverse=True)
N = n + 2
P = mod
inv_t = [0] + [1]
for i in range(2, N):
    inv_t += [inv_t[P % i] * (P - int(P / i)) % P]
base = 1
for item in range(n - k + 1, n):
    base = (base * item) % mod
for i in range(1, k):
    base = (base * inv_t[i]) % mod
base2 = base
ans = 0
top = n - 1
for ai in a:
    if top < k - 1:
        break
    ans += base * ai
    ans %= mod
    base = base * inv_t[top] * (top - k + 1) % mod
    top -= 1
top = n - 1
for ai in reversed(a):
    if top < k - 1:
        break
    ans -= base2 * ai
    ans %= mod
    base2 = base2 * inv_t[top] * (top - k + 1) % mod
    top -= 1
print((ans % mod))

-ans2 = 0 -    if ai > 0: -        ans += base * ai -        ans %= mod -    else: -        ans2 += abs(base * ai) -        ans2 %= mod +    ans += base * ai +    ans %= mod -    if ai > 0: -        ans2 += base2 * ai -        ans2 %= mod -    else: -        ans += abs(base2 * ai) -        ans %= mod +    ans -= base2 * ai +    ans %= mod -print(((ans - ans2) % mod)) +print((ans % mod))