#----------------------------------------------------------

P = 10**9 + 7

N = 200000 #使える最大値、値に注意

inv = [0] + [1] # 1/x

finv = [1] + [1] # 1/x!

fac = [1] + [1] # x!

for i in range(2,N):

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

  fac += [(fac[i-1] * i) % P]

  finv += [(finv[i-1] * inv[i]) % P]



def comb(a, b):

    if a<b:

        return -1 # error

    return (fac[a] * ((finv[b] * finv[a-b]) % P)) %P

#----------------------------------------------------------



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

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

a = sorted(a, key=lambda x: x, reverse=False)

ans = 0

# a[i]が最小値になる場合の数

for i in range(len(a)):

    tmp = comb(n-1-i, k-1)

    if tmp<0:

        continue

    if a[i] < 0:

        ans = (ans + (abs(a[i])*tmp)%P)%P

    else:

        ans = (ans - (abs(a[i])*tmp)%P + P)%P



# a[i]が最大値になる場合の数

for i in range(len(a)):

    tmp = comb(n-1-i, k-1)

    if tmp<0:

        continue

    if a[n-1-i] < 0:

        ans = (ans - (abs(a[n-1-i])*tmp)%P + P)%P

    else:

        ans = (ans + (abs(a[n-1-i])*tmp)%P)%P

print(ans)

#----------------------------------------------------------

P = 10**9 + 7

N = 100001 #使う最大値+1以上にする、値に注意3*10^5とかにしとくと安心

inv = [0] + [1] # 1/x

finv = [1] + [1] # 1/x!

fac = [1] + [1] # x!

for i in range(2,N):

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

  fac += [(fac[i-1] * i) % P]

  finv += [(finv[i-1] * inv[i]) % P]



def comb(a, b):

    if a<b:

        return -1 # error

    return (fac[a] * ((finv[b] * finv[a-b]) % P)) %P

#----------------------------------------------------------



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

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

a = sorted(a, key=lambda x: x, reverse=False)

ans = 0

# a[i]が最小値になる場合の数

for i in range(len(a)):

    tmp = comb(n-1-i, k-1)

    if tmp<0:

        continue

    if a[i] < 0:

        ans = (ans + (abs(a[i])*tmp)%P)%P

    else:

        ans = (ans - (abs(a[i])*tmp)%P + P)%P



# a[i]が最大値になる場合の数

for i in range(len(a)):

    tmp = comb(n-1-i, k-1)

    if tmp<0:

        continue

    if a[n-1-i] < 0:

        ans = (ans - (abs(a[n-1-i])*tmp)%P + P)%P

    else:

        ans = (ans + (abs(a[n-1-i])*tmp)%P)%P

print(ans)

# ----------------------------------------------------------
P = 10**9 + 7
N = 200000  # 使える最大値、値に注意
inv = [0] + [1]  # 1/x
finv = [1] + [1]  # 1/x!
fac = [1] + [1]  # x!
for i in range(2, N):
    inv += [inv[P % i] * (P - int(P / i)) % P]
    fac += [(fac[i - 1] * i) % P]
    finv += [(finv[i - 1] * inv[i]) % P]


def comb(a, b):
    if a < b:
        return -1  # error
    return (fac[a] * ((finv[b] * finv[a - b]) % P)) % P


# ----------------------------------------------------------
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
a = sorted(a, key=lambda x: x, reverse=False)
ans = 0
# a[i]が最小値になる場合の数
for i in range(len(a)):
    tmp = comb(n - 1 - i, k - 1)
    if tmp < 0:
        continue
    if a[i] < 0:
        ans = (ans + (abs(a[i]) * tmp) % P) % P
    else:
        ans = (ans - (abs(a[i]) * tmp) % P + P) % P
# a[i]が最大値になる場合の数
for i in range(len(a)):
    tmp = comb(n - 1 - i, k - 1)
    if tmp < 0:
        continue
    if a[n - 1 - i] < 0:
        ans = (ans - (abs(a[n - 1 - i]) * tmp) % P + P) % P
    else:
        ans = (ans + (abs(a[n - 1 - i]) * tmp) % P) % P
print(ans)

# ----------------------------------------------------------
P = 10**9 + 7
N = 100001  # 使う最大値+1以上にする、値に注意3*10^5とかにしとくと安心
inv = [0] + [1]  # 1/x
finv = [1] + [1]  # 1/x!
fac = [1] + [1]  # x!
for i in range(2, N):
    inv += [inv[P % i] * (P - int(P / i)) % P]
    fac += [(fac[i - 1] * i) % P]
    finv += [(finv[i - 1] * inv[i]) % P]


def comb(a, b):
    if a < b:
        return -1  # error
    return (fac[a] * ((finv[b] * finv[a - b]) % P)) % P


# ----------------------------------------------------------
n, k = list(map(int, input().split()))
a = list(map(int, input().split()))
a = sorted(a, key=lambda x: x, reverse=False)
ans = 0
# a[i]が最小値になる場合の数
for i in range(len(a)):
    tmp = comb(n - 1 - i, k - 1)
    if tmp < 0:
        continue
    if a[i] < 0:
        ans = (ans + (abs(a[i]) * tmp) % P) % P
    else:
        ans = (ans - (abs(a[i]) * tmp) % P + P) % P
# a[i]が最大値になる場合の数
for i in range(len(a)):
    tmp = comb(n - 1 - i, k - 1)
    if tmp < 0:
        continue
    if a[n - 1 - i] < 0:
        ans = (ans - (abs(a[n - 1 - i]) * tmp) % P + P) % P
    else:
        ans = (ans + (abs(a[n - 1 - i]) * tmp) % P) % P
print(ans)

-N = 200000  # 使える最大値、値に注意 +N = 100001  # 使う最大値+1以上にする、値に注意3*10^5とかにしとくと安心