#include <bits/stdc++.h>
using namespace std;

#define int long long
#define MOD 1000000007

int n, k;

int kai[100010];
int rkai[100010];

int a[100010];

int pow_mod(int i, int j){
    int ans = 1;
    while(j > 0){
        if(j & 1) ans = (ans * i) % MOD;
        i = i * i % MOD;
        j >>= 1;
    }
    return ans;
}

int combi(int n, int r){
    if(n < r) return 0;
    return kai[n] * rkai[r] % MOD * rkai[n-r] % MOD;
}

signed main(){
    cin >> n >> k;

    kai[0] = 1;
    rkai[0] = 1;

    for(int i = 1;i < 100010;i++) kai[i] = (kai[i-1] * i) % MOD;
    for(int i = 1;i < 100010;i++) rkai[i] = (rkai[i-1] * pow_mod(i, MOD-2)) % MOD;

    for(int i = 0;i < n;i++){
        cin >> a[i];
    }

    int ans = 0;

    sort(a, a+n);

    for(int i = 0;i < n;i++){
        ans = (ans + a[i] * combi(i, k-1) % MOD) % MOD;
        ans = (MOD + ans + (- a[i] * combi(n-(i+1), k-1)) % MOD) % MOD;
    }

    cout << ans << endl;
    return 0;
}
