#include<cstdio>
#include<algorithm>
using namespace std;
const int p=1000000007,N=1e5+10;
int n,k,a[N],inv[N];
int main()
{
freopen("perica.in","r",stdin);
freopen("perica.out","w",stdout);
scanf("%d%d",&n,&k);
for (int i=1;i<=n;i++) scanf("%d",&a[i]);
sort(a+1,a+n+1);
inv[1]=1;
for (int i=2;i<=n;i++)
inv[i]=1ll*(p-p/i)*inv[p%i]%p;
long long ans=0,now=1;
for (int pos=k;pos<=n;pos++){
ans=(ans+now*a[pos])%p;
now=now*inv[pos-k+1]%p*pos%p;
}
printf("%lld\n",ans);
return 0;
}