#include <iostream>
#include <bits/stdc++.h>

using namespace std;

#define ll long long
#define pb push_back
#define pf push_front
#define lb lower_bound
#define ub upper_bound
#define Loop(i, a, b) for(int i = a ; i < b ; ++i)
#define loop(i, n) Loop(i, 0, n)
#define ff first
#define ss second
#define mkp make_pair
#define pii pair<int, int>
#define vi vector<int>
#define vvi vector<vi>
#define vii vector<pii>
#define vvii vector<vii>
#define vl vector<ll>
#define vvl vector<vl>
#define pll pair<ll, ll>
#define vll vector<pll>
#define vvll vector<vll>
#define all(x) x.begin(), x.end()
#define sz(x) (int)x.size()
#define nmbr(c) (int)(c-'0')
#define ltr(c) (int)(c-'a')
#define INF 1e18+5
#define inf 1e9+5
#define _69e27 ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0)

#define sim template < class c
#define ris return * this
#define dor > debug & operator <<
#define eni(x) sim > typename \
  enable_if<sizeof dud<c>(0) x 1, debug&>::type operator<<(c i) {
sim > struct rge { c b, e; };
sim > rge<c> range(c i, c j) { return rge<c>{i, j}; }
sim > auto dud(c* x) -> decltype(cerr << *x, 0);
sim > char dud(...);
struct debug {
#ifdef LOCAL
~debug() { cerr << endl; }
eni(!=) cerr << boolalpha << i; ris; }
eni(==) ris << range(begin(i), end(i)); }
sim, class b dor(pair < b, c > d) {
  ris << "(" << d.first << ", " << d.second << ")";
}
sim dor(rge<c> d) {
  *this << "[";
  for (auto it = d.b; it != d.e; ++it)
    *this << ", " + 2 * (it == d.b) << *it;
  ris << "]";
}
#else
sim dor(const c&) { ris; }
#endif
};
#define trace(...) " [" << #__VA_ARGS__ ": " << (__VA_ARGS__) << "] "

template <typename T> T max(T a, T b, T c){ return max(a, max(b, c));}
template <typename T> T min(T a, T b, T c){ return min(a, min(b, c));}

const int M = 1e9+7; //check
const int maxn = 1e5+5;
ll gcd(ll a, ll b, ll & x, ll & y) {
    if (a == 0) {
        x = 0;
        y = 1;
        return b;
    }
    ll x1, y1;
    ll d = gcd(b % a, a, x1, y1);
    x = y1 - (b / a) * x1;
    y = x1;
    return d;
}
 
ll power(ll a, ll b)
{
	if(b == 0)
		return 1;
	if(b % 2 == 0)
	{
		ll q = power(a, b/2);
		return q*q % M;
	}
	return a * power(a, b-1) % M;
}
ll fact[maxn];
int main() {
	_69e27;
	fact[0] = 1;
	Loop(i, 1, maxn) fact[i] = fact[i-1]*i % M;
	int n, k;
	cin >> n >> k;
	vi v(n);
	loop(i, n) cin >> v[i];
	sort(all(v));
	int i = 0;
	ll ans = 0;
	while(i < n)
	{
		int cur = i;
		//while(i+1 < n && v[i] == v[i+1]) ++i;
		if(i+1-k < 0)
		{
			++i;
			continue;
		}
		ll top = v[i] * (i-cur+1) * fact[i] % M;
		ll bottom = fact[k-1] * fact[i-k+1] % M;
		debug() << trace(i) trace(cur) trace(top) trace(bottom);
		ll inv, y, g;
		g = gcd(bottom, M, inv, y);
		while(inv < 0) inv += M;
		ll tot = top*inv %M;
		ans += tot;	
		ans %= M;
		while(ans < 0) ans += M;
		++i;
	}
	i = n-1;
	while(i >= 0)
	{
		int cur = i;
		//while(i-1 > 0 && v[i] == v[i-1]) --i;
		if(n-i < k)
		{
			--i;
			continue;
		}
		ll top = v[i]*(i-cur+1) * fact[n-i-1] % M;
		ll bottom = fact[k-1] * fact[n-i-k] % M;
		debug() << trace(i) trace(cur) trace(top) trace(bottom);
		ll inv, y, g;
		g = gcd(bottom, M, inv, y);
		while(inv < 0) inv += M;
		ll tot = top*inv % M;
		ans -= tot;
		ans %= M;
		while(ans < 0) ans += M;
		--i;
	}
	cout << ans;
	return 0;
}

Measured memory_bytes: 1408