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

const LL P = 1e9+7;

LL fp(LL a, LL n){
    if(n==0)
        return 1LL;

    LL h = fp(a, n/2);
    h = h*h%P;
    if(n&1)
        h = h * a %P;
    return h;
}

LL fac(LL n){
    return n==0 ? 1LL : fac(n-1) * n % P;
}

int a[100010];

int main(){
    int n, k;
    cin >>n>>k;
    for(int i=1;i<=n;i++){
        cin >>a[i];
    }

    sort(a+1, a+n+1);

    LL f = fac(k-1);
    LL revf1 = fp(f, P-2);
    LL revf2 = 1;
    //cout << f<<" "<<revf1<<" "<<revf2<<endl;
    LL ans = 0;
    for(int i=0;i<n-k+1;i++){
        LL c = a[k+i] - a[n-k+1-i];
        c %= P;
        if(c<0)
            c+= P;

        ans +=  c * (f * revf1 % P * revf2 % P) % P;
        ans %= P;

        f = f * (k+i) % P;
        revf2 = revf2 * fp(i+1, P-2) % P;

       // cout << f <<" "<<revf1<<" "<<revf2<<endl;
    }
    cout << ans<<endl;
}
