#include<bits/stdc++.h>
using namespace std;
#define debug(a) cout << #a << ": " << a << endl
#define sz(a) int(a.size())
#define rep(i,n) for(int i=0;i<n;i++)
#define all(v) (v).begin(),(v).end()
#define fast cin.tie(0); ios::sync_with_stdio(false)


//template starts here

template <int MOD_> struct mint {
	static constexpr int MOD = MOD_;
	static_assert(MOD_ > 0, "MOD must be positive");

private:
	using ll = long long;

	int v;

	static int minv(int a, int m) {
		a %= m;
		assert(a);
		return a == 1 ? 1 : int(m - ll(minv(m, a)) * ll(m) / a);
	}

public:

	mint() : v(0) {}
	mint(ll v_) : v(int(v_ % MOD)) { if (v < 0) v += MOD; }
	explicit operator int() const { return v; }
	friend std::ostream& operator << (std::ostream& out, const mint& n) { return out << int(n); }
	friend std::istream& operator >> (std::istream& in, mint& n) { ll v_; in >> v_; n = mint(v_); return in; }

	friend bool operator == (const mint& a, const mint& b) { return a.v == b.v; }
	friend bool operator != (const mint& a, const mint& b) { return a.v != b.v; }

	mint inv() const {
		mint res;
		res.v = minv(v, MOD);
		return res;
	}
	friend mint inv(const mint& m) { return m.inv(); }
	mint neg() const {
		mint res;
		res.v = v ? MOD-v : 0;
		return res;
	}
	friend mint neg(const mint& m) { return m.neg(); }

	mint operator- () const {
		return neg();
	}
	mint operator+ () const {
		return mint(*this);
	}

	mint& operator ++ () {
		v ++;
		if (v == MOD) v = 0;
		return *this;
	}
	mint& operator -- () {
		if (v == 0) v = MOD;
		v --;
		return *this;
	}
	mint& operator += (const mint& o) {
		v += o.v;
		if (v >= MOD) v -= MOD;
		return *this;
	}
	mint& operator -= (const mint& o) {
		v -= o.v;
		if (v < 0) v += MOD;
		return *this;
	}
	mint& operator *= (const mint& o) {
		v = int(ll(v) * ll(o.v) % MOD);
		return *this;
	}
	mint& operator /= (const mint& o) {
		return *this *= o.inv();
	}

	friend mint operator ++ (mint& a, int) { mint r = a; ++a; return r; }
	friend mint operator -- (mint& a, int) { mint r = a; --a; return r; }
	friend mint operator + (const mint& a, const mint& b) { return mint(a) += b; }
	friend mint operator - (const mint& a, const mint& b) { return mint(a) -= b; }
	friend mint operator * (const mint& a, const mint& b) { return mint(a) *= b; }
	friend mint operator / (const mint& a, const mint& b) { return mint(a) /= b; }
};

template <typename T> T pow(T a, long long b) {
	assert(b >= 0);
	T r = 1; while (b) { if (b & 1) r *= a; b >>= 1; a *= a; } return r;
}

using num = mint<1000000007>;

vector<num> fact, ifact;

void init(){
	int N = 1100000;
	fact = {1};
	for(int i = 1; i < N; i++) fact.push_back(i * fact[i-1]);
	ifact.resize(N);
	ifact.back() = 1 / fact.back();
	for(int i = N - 1; i > 0; i--) ifact[i-1] = i * ifact[i];
}
 
num ncr(int n, int k){
	if(k < 0 || k > n) return 0;
	return fact[n] * ifact[k] * ifact[n-k];
}

//template stops here


const int MOD = 1e9 + 7;
int main(){	fast;
	
	init();
	int n, k; cin>>n>>k;
	vector<int> a(n);
	rep(i, n){
		cin>>a[i];
	}
	sort(all(a));
	num ans = 0;
	rep(i, n - 1){
		num diff = (a[i + 1] - a[i]);
		num ways = ncr(n, k);
		ways -= ncr(i + 1, k);
		ways -=  ncr(n - i - 1, k);
		ans = (ans + diff * ways);
	}
	cout<<ans<<endl;
}


Measured memory_bytes: 10728