#include "bits/stdc++.h"
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;

typedef long long ll;

const ll MOD = 1e9 + 7;

ll mod_pow(ll x, ll n, ll mod) {
    ll res = 1;
    while (n > 0) {
        if (n & 1) res = res * x % mod;
        x = x * x % mod;
        n >>= 1;
    }
    return res;
}

int main() {
    ll N, K, ans = 0, x;
    cin >> N >> K;
    vector<ll> A(N), f(N + 1, 1);
    rep(i, N) {
        cin >> A[i];
    }
    rep(i, N) f[i + 1] = (f[i] * (i + 1)) % MOD;
    sort(A.begin(), A.end());
    rep(i, N - K + 1) {
        x = (f[N - i - 1] * mod_pow(f[K - 1], MOD - 2, MOD)) % MOD;
        x *= mod_pow(f[N - i - K], MOD - 2, MOD);
        x %= MOD;
        x *= (A[N - 1 - i] - A[i] + MOD + MOD) % MOD;
        x %= MOD;
        ans += x;
        ans %= MOD;
        //cout << ans << endl;
    }
    cout << ans << endl;
    //rep(i, N) cout << f[i] << endl;
}