#include<bits/stdc++.h> #define LL long long using namespace std; int a[100005], w[15], f[100005][15]; const int mod=1e9+7; int main(){ int n, m, k; while(~scanf("%d%d%d", &n, &m, &k)){ for(int i=1; i<=n; i++){ scanf("%d", &a[i]); } memset(w, 0, sizeof(w)); f[0][0]=1; for(int i=1; i<=n; i++){ for(int j=0; j<=m; j++){ if(j==0) f[i][j]=f[i-1][j]; else f[i][j]=(f[i-1][j]+f[i-1][j-1])%mod; if(w[a[i]]){ if(i-w[a[i]]<=j){ f[i][j]=((f[i][j]-f[w[a[i]]-1][j-(i-w[a[i]])])+mod)%mod; } } //cout<<i<<" "<<j<<" : "<<f[i][j]<<endl; } w[a[i]]=i; } printf("%d\n", f[n][m]); } return 0; }