#include using namespace std; const int N=90,Mod=1e9+7; int n,c,a[N],ans[N],sum; void dfs(int u,int lst) { if(u==c+1) { long long tot=a[ans[1]]; bool flag=false; for(int i=2;i<=c;i++) { if(ans[i]!=ans[1]) flag=true; tot=tot*a[ans[i]]%Mod; } //printf("%d %d\n",ans[1],ans[2]); if(flag) sum=(sum+tot)%Mod; return; } for(int i=lst;i<=n;i++) ans[u]=i,dfs(u+1,i); } int main() { //freopen("spice.in","r",stdin); //freopen("spice.out","w",stdout); scanf("%d %d",&n,&c); for(int i=1;i<=n;i++) scanf("%d",&a[i]); dfs(1,1),printf("%d",sum); return 0; }