#include <iostream>
#include <algorithm>
#define ll long long
using namespace std;

ll mod=1000000007, a[100010];
const int SIZE=110000;
ll fac[SIZE], finv[SIZE], inv[SIZE];
void COMinit(ll m){
    fac[0]=fac[1]=1;
    finv[0]=finv[1]=1;
    inv[1]=1;
    for (int i=2; i<SIZE; ++i){
        fac[i]=(fac[i-1]*i)%m;
        inv[i]=m-(inv[m%i]*(m/i))%m;
        finv[i]=(finv[i-1]*inv[i])%m;
    }
}
ll COM(int n, int k, ll m){
    if(n<k) return 0;
    if(n<0 || k<0) return 0;
    return (fac[n]*((finv[k]*finv[n-k])%m))%m;
}

int main() {
	int N, K;
	cin >> N >> K;
	for(int i=0; i<N; ++i) cin >> a[i];
	sort(a, a+N);
	COMinit(mod);
	ll ans=0;
	for(int i=0; i<N; ++i){
		if(a[i]<0) a[i] += mod;
		ans=(ans+(a[i]*COM(i, K-1, mod))%mod)%mod;
		ans=(ans+mod-(a[i]*COM(N-i-1, K-1, mod))%mod)%mod;
	}
	cout << ans << endl;
	return 0;
}