#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<list>
#include<string>
#include<cstring>

using namespace std;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) (int)(x).size()
#define SORT(x) sort((x).begin(),(x).end())
#define CLEAR(tab) memset(tab, 0, sizeof(tab))
#define REP(x, n) for(int x = 0; x < (n); x++)
#define FOR(x, b, e) for(int x = (b); x <= (e); x++)
#define FORD(x, b, e) for(int x = (b); x >= (e); x--)
#define VAR(v, n) __typeof(n) v = (n)
#define FOREACH(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define DEBUG(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__)

const int MAX_BUF_SIZE = 16384;
char BUFOR[MAX_BUF_SIZE];
int BUF_SIZE, BUF_POS;
char ZZZ;
#define GET(ZZZ){ZZZ='a';if(BUF_POS<BUF_SIZE)ZZZ=BUFOR[BUF_POS++];\
else if(!feof(stdin)){BUF_SIZE=fread(BUFOR,1,MAX_BUF_SIZE,stdin);\
ZZZ=BUFOR[0];BUF_POS=1;}}
#define GI(WW){do{GET(ZZZ);}while(!isdigit(ZZZ));WW=ZZZ-'0';\
while(1){GET(ZZZ);if(!isdigit(ZZZ))break;WW=WW*10+(ZZZ-'0');}}
#define GC(WW){do{GET(ZZZ);}while(!isalpha(ZZZ));WW=ZZZ;}

//FAST IO

typedef long long int LL;
typedef pair<int,int> PII;
typedef vector<int> VI;

const int MXN = 1000010;
const int C = 262144;
const int INF = 1000000001;
const int MOD = 1000000007;

int n, k;
LL l;
vector<int> d[MXN];
int a[MXN];

void init() {
	FOR(i, 1, n)
		d[i].resize(k + 1);

	FOR(i, 1, n)
		d[i][1] = 1;
	FOR(i, 1, k)
		d[1][i] = 1;

	FOR(i, 2, n)
		FOR(j, 2, k)
			d[i][j] = (d[i][j - 1] + d[i - 1][j]) % MOD;
}

void test() {
	cin>>n>>l>>k;

	init();

	FOR(i, 1, n)
		scanf("%d", &a[i]);
	sort(a + 1, a + 1 + n);

	LL bloki = l / n;
	LL ile = min(bloki, bloki - k + 1);
	int res = 0;

	FOR(i, 1, k) {
		LL ile = min(bloki, bloki - i + 1);
		//ile blokow o dlugosci i;

		if(ile > 0)
			FOR(j, 1, n)
				res = (res + ((LL)ile * d[j][i] % MOD) ) % MOD;
	}

	LL p = l % n;
	FOR(i, 1, k) {
		LL ile = min(bloki, bloki - i + 1);
		if(i <= ile + 1)
		FOR(j, 1, p)
			res = (res + d[j][i]) % MOD;
	}

	printf("%d\n", res);
}

int main() {
	int te = 1;
//	scanf("%d", &te);
	while(te--)
		test();
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<list>
#include<string>
#include<cstring>

using namespace std;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) (int)(x).size()
#define SORT(x) sort((x).begin(),(x).end())
#define CLEAR(tab) memset(tab, 0, sizeof(tab))
#define REP(x, n) for(int x = 0; x < (n); x++)
#define FOR(x, b, e) for(int x = (b); x <= (e); x++)
#define FORD(x, b, e) for(int x = (b); x >= (e); x--)
#define VAR(v, n) __typeof(n) v = (n)
#define FOREACH(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define DEBUG(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__)

const int MAX_BUF_SIZE = 16384;
char BUFOR[MAX_BUF_SIZE];
int BUF_SIZE, BUF_POS;
char ZZZ;
#define GET(ZZZ){ZZZ='a';if(BUF_POS<BUF_SIZE)ZZZ=BUFOR[BUF_POS++];\
else if(!feof(stdin)){BUF_SIZE=fread(BUFOR,1,MAX_BUF_SIZE,stdin);\
ZZZ=BUFOR[0];BUF_POS=1;}}
#define GI(WW){do{GET(ZZZ);}while(!isdigit(ZZZ));WW=ZZZ-'0';\
while(1){GET(ZZZ);if(!isdigit(ZZZ))break;WW=WW*10+(ZZZ-'0');}}
#define GC(WW){do{GET(ZZZ);}while(!isalpha(ZZZ));WW=ZZZ;}

//FAST IO

typedef long long int LL;
typedef pair<int,int> PII;
typedef vector<int> VI;

const int MXN = 1000010;
const int C = 262144;
const int INF = 1000000001;
const int MOD = 1000000007;

int n, k;
LL l;
vector<int> d[MXN];

void init() {
	FOR(i, 1, n)
		d[i].resize(k + 1);

	FOR(i, 1, n)
		d[i][1] = 1;
	FOR(i, 1, k)
		d[1][i] = 1;

	FOR(i, 2, n)
		FOR(j, 2, k)
			d[i][j] = (d[i][j - 1] + d[i - 1][j]) % MOD;
}

int gdzie[MXN];
PII a[MXN];

void test() {
	cin>>n>>l>>k;

	init();

	FOR(i, 1, n) {
		scanf("%d", &a[i].F);
		a[i].S = i;
	}
	sort(a + 1, a + 1 + n);
    FOR(i, 1, n)
        gdzie[a[i].S] = i;

	LL bloki = l / n;
	LL ile = min(bloki, bloki - k + 1);
	int res = 0;

	FOR(i, 1, k) {
		LL ile = min(bloki, bloki - i + 1);
		//ile blokow o dlugosci i;

		if(ile > 0)
			FOR(j, 1, n)
				res = (res + ((LL)ile * d[j][i] % MOD) ) % MOD;
	}

//	FOR(i, 1, l % n)
//		d[i][0] = 1;
	LL p = l % n;
	FOR(i, 1, k) {
		LL ile = min(bloki, bloki - i + 2);
//		cout<<ile<<" "<<i<<endl;
        if(i <= ile + 1)
        FOR(j, 1, p)
			res = (res + d[gdzie[j] ][i]) % MOD;

	}

	printf("%d\n", res);
}

int main() {
	int te = 1;
//	scanf("%d", &te);
	while(te--)
		test();
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<list>
#include<string>
#include<cstring>

using namespace std;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) (int)(x).size()
#define SORT(x) sort((x).begin(),(x).end())
#define CLEAR(tab) memset(tab, 0, sizeof(tab))
#define REP(x, n) for(int x = 0; x < (n); x++)
#define FOR(x, b, e) for(int x = (b); x <= (e); x++)
#define FORD(x, b, e) for(int x = (b); x >= (e); x--)
#define VAR(v, n) __typeof(n) v = (n)
#define FOREACH(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define DEBUG(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__)

const int MAX_BUF_SIZE = 16384;
char BUFOR[MAX_BUF_SIZE];
int BUF_SIZE, BUF_POS;
char ZZZ;
#define GET(ZZZ){ZZZ='a';if(BUF_POS<BUF_SIZE)ZZZ=BUFOR[BUF_POS++];\
else if(!feof(stdin)){BUF_SIZE=fread(BUFOR,1,MAX_BUF_SIZE,stdin);\
ZZZ=BUFOR[0];BUF_POS=1;}}
#define GI(WW){do{GET(ZZZ);}while(!isdigit(ZZZ));WW=ZZZ-'0';\
while(1){GET(ZZZ);if(!isdigit(ZZZ))break;WW=WW*10+(ZZZ-'0');}}
#define GC(WW){do{GET(ZZZ);}while(!isalpha(ZZZ));WW=ZZZ;}

//FAST IO

typedef long long int LL;
typedef pair<int,int> PII;
typedef vector<int> VI;

const int MXN = 1000010;
const int C = 262144;
const int INF = 1000000001;
const int MOD = 1000000007;

int n, k;
LL l;
vector<LL> d[MXN];
VI kappa;
int N;

map<LL,int> gdzie;
LL a[MXN];
LL b[MXN];

int pot(int x, int p) {
    int res = 1;
    int tmp = x;
    while(p) {
        if(p % 2)
            res = ((LL)res * tmp) % MOD;
        tmp = ((LL)tmp * tmp) % MOD;
        p /= 2;
    }
    return res;
}

int odw(int x) {
    return pot(x, MOD - 2);
}

void init() {
	FOR(i, 1, N)
		d[i].resize(k + 1);

    d[1][0] = 1;
	FOR(i, 1, N)
		d[i][1] = kappa[i];
	FOR(i, 1, k)
		d[1][i] = ((LL)kappa[1] * d[1][i - 1]) % MOD;

	FOR(i, 2, N)
		FOR(j, 2, k) {
			d[i][j] = (LL)kappa[i] * d[i][j - 1] % MOD;
			d[i][j] += ((LL)kappa[i] * odw(kappa[i - 1]) % MOD) * (LL)d[i - 1][j] % MOD;
			d[i][j] %= MOD;
		}
}

void test() {
	cin>>n>>l>>k;

	FOR(i, 1, n) {
		scanf("%d", &a[i]);
        b[i] = a[i];
	}

	sort(a + 1, a + 1 + n);
    kappa.PB(0);

    FOR(i, 1, n) {
        int iter = i;
        while(iter <= n && a[iter] == a[i])
            iter++;

        kappa.PB(iter - i);
        gdzie[a[i]] = SIZE(kappa) - 1;
        i = iter - 1;
    }
    N = SIZE(kappa) - 1;
    init();

	LL bloki = l / n;
	int res = 0;

	FOR(i, 1, k) {
		LL ile = bloki - i + 1;
		if(ile > 0)
			FOR(j, 1, N)
				res = (res + ((LL)(ile % MOD) * d[j][i] % MOD) ) % MOD;
	}

	LL p = l % n;
	FOR(i, 1, k) {
        if(bloki >= i - 1)
            FOR(j, 1, p)
                res = (res + ((LL)d[gdzie[b[j] ] ][i] * odw(kappa[gdzie[b[j]]]) % MOD ) ) % MOD;
	}

	printf("%d\n", res);
}

int main() {
	int te = 1;
//	scanf("%d", &te);
	while(te--)
		test();
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<algorithm>
#include<vector>
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<list>
#include<string>
#include<cstring>

using namespace std;

#define PB push_back
#define MP make_pair
#define F first
#define S second
#define ALL(x) (x).begin(),(x).end()
#define SIZE(x) (int)(x).size()
#define SORT(x) sort((x).begin(),(x).end())
#define CLEAR(tab) memset(tab, 0, sizeof(tab))
#define REP(x, n) for(int x = 0; x < (n); x++)
#define FOR(x, b, e) for(int x = (b); x <= (e); x++)
#define FORD(x, b, e) for(int x = (b); x >= (e); x--)
#define VAR(v, n) __typeof(n) v = (n)
#define FOREACH(i, c) for(VAR(i, (c).begin()); i != (c).end(); ++i)
#define DEBUG(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__)

const int MAX_BUF_SIZE = 16384;
char BUFOR[MAX_BUF_SIZE];
int BUF_SIZE, BUF_POS;
char ZZZ;
#define GET(ZZZ){ZZZ='a';if(BUF_POS<BUF_SIZE)ZZZ=BUFOR[BUF_POS++];\
else if(!feof(stdin)){BUF_SIZE=fread(BUFOR,1,MAX_BUF_SIZE,stdin);\
ZZZ=BUFOR[0];BUF_POS=1;}}
#define GI(WW){do{GET(ZZZ);}while(!isdigit(ZZZ));WW=ZZZ-'0';\
while(1){GET(ZZZ);if(!isdigit(ZZZ))break;WW=WW*10+(ZZZ-'0');}}
#define GC(WW){do{GET(ZZZ);}while(!isalpha(ZZZ));WW=ZZZ;}

//FAST IO

typedef long long int LL;
typedef pair<int,int> PII;
typedef vector<int> VI;

const int MXN = 1000010;
const int C = 262144;
const int INF = 1000000001;
const int MOD = 1000000007;

int n, k;
LL l;
vector<int> d[MXN];

void init() {
	FOR(i, 1, n)
		d[i].resize(k + 1);

	FOR(i, 1, n)
		d[i][1] = 1;
	FOR(i, 1, k)
		d[1][i] = 1;

	FOR(i, 2, n)
		FOR(j, 2, k)
			d[i][j] = (d[i][j - 1] + d[i - 1][j]) % MOD;
}

map<LL,int> gdzie;
PII a[MXN];
int b[MXN];

void test() {
	cin>>n>>l>>k;

	init();

	FOR(i, 1, n) {
		scanf("%d", &a[i].F);
		a[i].S = i;
        b[i] = a[i].F;
	}

	sort(a + 1, a + 1 + n);
    FOR(i, 1, n)
        gdzie[a[i].F] = i;

	LL bloki = l / n;
	LL ile = min(bloki, bloki - k + 1);
	int res = 0;

	FOR(i, 1, k) {
		LL ile = min(bloki, bloki - i + 1);
		//ile blokow o dlugosci i;

		if(ile > 0)
			FOR(j, 1, n)
				res = (res + ((LL)ile * d[j][i] % MOD) ) % MOD;
	}

//	FOR(i, 1, l % n)
//		d[i][0] = 1;
	LL p = l % n;
	FOR(i, 1, k) {
		LL ile = min(bloki, bloki - i + 2);
//		cout<<ile<<" "<<i<<endl;
        if(i <= ile + 1)
        FOR(j, 1, p)
			res = (res + d[gdzie[b[j] ] ][i]) % MOD;

	}

	printf("%d\n", res);
}

int main() {
	int te = 1;
//	scanf("%d", &te);
	while(te--)
		test();
	return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#define LL long long
using namespace std;

/*
我凑读错题了！！
本来以为[ij/n]+1<=[ij+1]
本来还以为用组合数，结果根本不用，本来很简单，啊！！！
结果怎么都不对最后看标程……其实比我刚开始以为的的简单多了！
*/
const LL mod = 1000000007,N = 1000010;
long long a[N],c[N],rank[N];
LL f[N],g[N];

struct sta
{
    int x,id;
    bool operator <(const sta &n2) const {
        return x<n2.x;
    }
}s[N];

int main()
{
    LL n,k,tot = 0,l,ans = 0;
    cin >> n >> l >> k;
    for(int i = 0; i<n; i++)
        scanf("%d", &a[i]), s[i].x = a[i], s[i].id = i;
    sort(s, s+n);
    for(int i = 0; i<n; i++) {
        if(i==0 || s[i].x!=s[i-1].x)
            c[++tot] = 1;
        else c[tot]++;
        rank[s[i].id] = tot;
    }

    for(int i = 0; i<=min(k,l/n); i++)
    {
        if(i)
        {
            for(int j = 1; j<=tot; j++)
                f[j] = g[j]*c[j]%mod;
            for(int j = 1; j<=tot; j++)
                g[j] = (g[j-1]+f[j])%mod;
        }
        else
            for(int j = 1; j<=tot; j++) g[j] = 1;

        for(int j = 0; j<l%n; j++) //选i个整循环加上后面的不玩整循环
            ans = (ans+g[rank[j]]) %mod;
        if(i) ans = (ans +g[tot]*(l/n-i+1)) %mod;//i=0时g[tot]=0但不算。
    }
    cout << ans;
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#define LL long long
using namespace std;

/*
我凑读错题了！！
本来以为[ij/n]+1<=[ij+1]
本来还以为用组合数，结果根本不用，本来很简单，啊！！！
结果怎么都不对最后看标程……其实比我刚开始以为的的简单多了！
*/
const LL mod = 1000000007,N = 1000010;
long long a[N],c[N],rank[N];
LL f[N],g[N];

struct sta
{
    int x,id;
    bool operator <(const sta &n2) const {
        return x<n2.x;
    }
}s[N];

int main()
{
    LL n,k,tot = 0,l,ans = 0;
    cin >> n >> l >> k;
    for(int i = 0; i<n; i++)
        scanf("%d", &a[i]), s[i].x = a[i], s[i].id = i;
    sort(s, s+n);
    for(int i = 0; i<n; i++) {
        if(i==0 || s[i].x!=s[i-1].x)
            c[++tot] = 1;
        else c[tot]++;
        rank[s[i].id] = tot;
    }

    for(int i = 0; i<=min(k,l/n); i++)
    {
        if(i)
        {
            for(int j = 1; j<=tot; j++)
                f[j] = g[j]*c[j]%mod;
            for(int j = 1; j<=tot; j++)
                g[j] = (g[j-1]+f[j])%mod;
        }
        else for(int j = 1; j<=tot; j++) g[j] = 1;

        if(i<k) for(int j = 0; j<l%n; j++) //选i个整循环加上后面的不玩整循环
            ans = (ans+g[rank[j]]) %mod;
        if(i) ans = (ans +g[tot]* ((l/n-i+1)%mod) ) %mod;//i=0时g[tot]=0但不算。
    }
    cout << ans;
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#define LL long long
using namespace std;

/*
Ò»µÀÌâ×öÁËºÃ³¤Ê±¼ä¡¡
Ö÷ÒªÊÇÇó×éºÏÊý¶º±ÈÁË¡¡ÐèÒªÕûÒ»ÏÂÇó×éºÏÊýµÄ·½·¨ÁË
*/
const LL mod = 1000000007,N = 1000010;
int a[N],c[N],rank[N];
LL f[N],g[N],com[N];

struct sta
{
    int x,id;
    bool operator <(const sta &n2) const {
        return x<n2.x;
    }
}s[N];

void exgcd(LL a, LL b, LL &x, LL &y)
{
    if(b==0) {
        x = 1; y = 0; return;
    }
    exgcd(b,a%b,x,y);
    LL t = x; x = y, y = t-a/b*y;
}

LL rev(LL num)
{
    LL x,y; exgcd(num, mod, x, y);
    return ((x%mod)+mod)%mod;
}

int main()
{
    LL n,k,tot = 0,l,ans = 0;
    cin >> n >> l >> k;
    for(int i = 0; i<n; i++)
        scanf("%d", &a[i]), s[i].x = a[i], s[i].id = i;
    sort(s, s+n);
    for(int i = 0; i<n; i++) {
        if(i==0 || s[i].x!=s[i-1].x)
            c[++tot] = 1;
        else c[tot]++;
        rank[s[i].id] = tot;
    }
    com[0] = 1;
    for(int i = 1; i<=min(k,l/n); i++)
        com[i] = (com[i-1]*(l/n-i+1))%mod *rev(i)%mod;

    for(int i = 0; i<=min(k,l/n); i++)
    {

        if(i)
        {
            for(int j = 1; j<=tot; j++)
                f[j] = g[j]*c[j]%mod;
            for(int j = 1; j<=tot; j++)
                g[j] = (g[j-1]+f[j])%mod;
        }
        else
            for(int j = 1; j<=tot; j++) g[j] = 1;

        for(int j = 0; j<l%n; j++) //Ñ¡i¸öÕûÑ»·¼ÓÉÏºóÃæµÄ²»ÍæÕûÑ»·
            ans = (ans +com[i]*g[rank[j]]) %mod;
        if(i) ans = (ans +g[tot]*com[i]) %mod;//i=0Ê±g[tot]=0µ«²»Ëã¡£

    }
    cout << ans;
    return 0;
}


#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<vector>
#define LL long long
using namespace std;

/*
一道题做了好长时间……
主要是求组合数逗比了……需要整一下求组合数的方法了
*/
const LL mod = 1000000007,N = 1000010;
int a[N],c[N],rank[N];
LL f[N],g[N],com[N];

struct sta
{
	int x,id;
	bool operator <(const sta &n2) const {
		return x<n2.x;
	}
}s[N];

void exgcd(LL a, LL b, LL &x, LL &y)
{
	if(b==0) {
		x = 1; y = 0; return;
	}
	exgcd(b,a%b,x,y);
	LL t = x; x = y, y = t-a/b*y;
}

LL rev(LL num)
{
	LL x,y; exgcd(num, mod, x, y);
	return ((x%mod)+mod)%mod;
}

int main()
{
	LL n,k,tot = 0,l,ans = 0;
	cin >> n >> l >> k;
	for(int i = 0; i<n; i++)
		scanf("%d", &a[i]), s[i].x = a[i], s[i].id = i;
	sort(s, s+n);
	for(int i = 0; i<n; i++) {
		if(i==0 || s[i].x!=s[i-1].x)
			c[++tot] = 1;
		else c[tot]++;
		rank[s[i].id] = tot;
	}

	com[0] = 1;
	for(int i = 1; i<=l/n; i++)
		com[i] = (com[i-1]*(l/n-i+1))%mod *rev(i)%mod;

	for(int i = 0; i<=min(k,l/n); i++)
	{

		if(i)
		{
			for(int j = 1; j<=tot; j++)
				f[j] = g[j]*c[j]%mod;
			for(int j = 1; j<=tot; j++)
				g[j] = (g[j-1]+f[j])%mod;
		}
		else
			for(int j = 1; j<=tot; j++) g[j] = 1;

		for(int j = 0; j<l%n; j++) //选i个整循环加上后面的不玩整循环
			ans = (ans +com[i]*g[rank[j]]) %mod;
		if(i) ans = (ans +g[tot]*com[i]) %mod;//i=0时g[tot]=0但不算。

	}
	cout << ans;
	return 0;
}


#include<set>
#include<map>
#include<list>
#include<cmath>
#include<queue>
#include<ctime>
#include<stack>
#include<bitset>
#include<string>
#include<vector>
#include<cstdio>
#include<climits>
#include<cstring>
#include<iomanip>
#include<iostream>
#include<algorithm>
using namespace std;

const int mod=1e9+7;
const int maxn=1100000;

long long dp[maxn];
long long a[maxn];
long long tmp[maxn];
long long refer[maxn];
long long cnt[maxn];
long long n,l,k;

long long cal(long long i,long long j)
{
    return i*k+j;
}

int main()
{
    scanf("%I64d%I64d%I64d",&n,&l,&k);
    for(int i=0;i<n;i++)
    {
        scanf("%I64d",&a[i]);
        tmp[i]=a[i];
    }
    sort(tmp,tmp+n);
    for(int i=0;i<n;i++)
        refer[i]=lower_bound(tmp,tmp+n,a[i])-tmp;

    for(int i=0;i<n;i++)
        dp[cal(i,1)]=1;
    for(int j=2;j<=k;j++)
    {
        for(int i=0;i<n;i++)
            cnt[i]=0;
        for(int i=0;i<n;i++)
            cnt[refer[i]]=(cnt[refer[i]]+dp[cal(i,j-1)])%mod;
        for(int i=1;i<n;i++)
            cnt[i]=(cnt[i]+cnt[i-1])%mod;
        for(int i=0;i<n;i++)
            dp[cal(i,j)]=cnt[refer[i]];
    }

    long long ans=0;
    for(int i=0;i<n;i++)
    {
        for(int j=1;j<=k;j++)
        {
            long long num=l/n;
            if(i<l%n)
                num++;
            num=num-j+1;
            if(num>0)
                ans=(ans+((num%mod)*dp[cal(i,j)])%mod)%mod;
        }
    }
    printf("%I64d\n",ans);

    return 0;
}


#include<set>
#include<map>
#include<list>
#include<cmath>
#include<queue>
#include<ctime>
#include<stack>
#include<bitset>
#include<string>
#include<vector>
#include<cstdio>
#include<climits>
#include<cstring>
#include<iomanip>
#include<iostream>
#include<algorithm>
using namespace std;

const int mod=1e9+7;
const int maxn=1100000;

long long dp[maxn];
long long a[maxn];
long long tmp[maxn];
long long refer[maxn];
long long cnt[maxn];
long long n,l,k;

long long cal(long long i,long long j)
{
    return i*k+j;
}

int main()
{
    scanf("%I64d%I64d%I64d",&n,&l,&k);
    for(int i=0;i<n;i++)
    {
        scanf("%I64d",&a[i]);
        tmp[i]=a[i];
    }
    sort(tmp,tmp+n);
    for(int i=0;i<n;i++)
        refer[i]=lower_bound(tmp,tmp+n,a[i])-tmp;

    for(int i=0;i<n;i++)
        dp[cal(i,1)]=1;
    for(int j=2;j<=k;j++)
    {
        for(int i=0;i<n;i++)
            cnt[i]=0;
        for(int i=0;i<n;i++)
            cnt[refer[i]]=(cnt[refer[i]]+dp[cal(i,j-1)])%mod;
        for(int i=1;i<n;i++)
            cnt[i]=(cnt[i]+cnt[i-1])%mod;
        for(int i=0;i<n;i++)
            dp[cal(i,j)]=cnt[refer[i]];
    }

    long long ans=0;
    for(int i=0;i<n;i++)
    {
        for(int j=1;j<=k;j++)
        {
            long long num=l/n;
            if(i<l%n)
                num++;
            num=num-j+1;
            if(num>0)
                ans=(ans+(num*dp[cal(i,j)])%mod)%mod;
        }
    }
    printf("%I64d\n",ans);

    return 0;
}


#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <cmath>
#include <algorithm>
#include <string>

#define LL long long
#define EPS (1e-8)
#define INF  0x3f3f3f
#pragma comment(linker, "/STACK:1024000000,1024000000")

const int MOD = 1000000007;

using namespace std;

template <typename T>

inline void read(T& x)
{
    char ch;
    while (!((((ch=getchar())>='0') && (ch <= '9')) || (ch == '-')));
    x = ch-'0';
    while (((ch=getchar())>='0') && (ch <= '9')) x = x*10+ch-'0';
}

int num[1001000];

int st[4001000];

int tmp[1001000];

void Init(int site,int L,int R)
{
    if(L == R)
    {
        st[site] = 1;
        return ;
    }

    int mid = (L+R)>>1;

    Init(site<<1,L,mid);
    Init(site<<1|1,mid+1,R);

    st[site] = st[site<<1] + st[site<<1|1];
}

int Q(int site,int L,int R,int goal)
{
    if(R == goal) return st[site];

    int mid = (L+R)>>1;

    if(goal <= mid) return Q(site<<1,L,mid,goal);
    return (st[site<<1] + Q(site<<1|1,mid+1,R,goal))%MOD;
}

void U(int site,int L,int R,int goal,int info)
{
    if(L == R)
    {
        st[site] += info;
        return ;
    }

    int mid = (L+R)>>1;

    if(goal <= mid)
        U(site<<1,L,mid,goal,info);
    else
        U(site<<1|1,mid+1,R,goal,info);

    st[site] = st[site<<1] + st[site<<1|1];
}

int main()
{
    int n,k,l,i,j;

    scanf("%d %d %d",&n,&l,&k);

    for(i = 1;i <= n; ++i)
        scanf("%d",&num[i]),tmp[i] = num[i];

    sort(tmp+1,tmp+n+1);

    for(i = 2,j = 1;i <= n; ++i)
        if(tmp[i] != tmp[j]) tmp[++j] = tmp[i];

    int m = j;

    for(i = 1;i <= n; ++i)
        num[i] = lower_bound(tmp+1,tmp+m+1,num[i]) - tmp;

    Init(1,1,m);

    LL anw  = l;

    k = min(k,l/n + (l%n ? 1 : 0));
    //cout<<"k = "<<k<<endl;
    for(i = 2;i <= k; ++i)
    {
        for(j = 1;j <= n; ++j)
            tmp[j] = Q(1,1,n,num[j]);

        memset(st,0,sizeof(int)*(m*4+10));

        for(j = 1;j <= n; ++j)
        {
            U(1,1,m,num[j],tmp[j]);

            if(j == l%n)
            {
            //    cout<<st[1]<<endl;
                anw += st[1];
            }
        }

        (anw += st[1]*(l/n - i+1)) %= MOD;
    }

    printf("%d\n",anw);

    return 0;
}


#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <cmath>
#include <algorithm>
#include <string>

#define LL long long
#define EPS (1e-8)
#define INF  0x3f3f3f
#pragma comment(linker, "/STACK:1024000000,1024000000")

const int MOD = 1000000007;

using namespace std;

template <typename T>

inline void read(T& x)
{
    char ch;
    while (!((((ch=getchar())>='0') && (ch <= '9')) || (ch == '-')));
    x = ch-'0';
    while (((ch=getchar())>='0') && (ch <= '9')) x = x*10+ch-'0';
}

int num[1001000];

int st[4001000];

int tmp[1001000];

void Init(int site,int L,int R)
{
    if(L == R)
    {
        st[site] = 1;
        return ;
    }

    int mid = (L+R)>>1;

    Init(site<<1,L,mid);
    Init(site<<1|1,mid+1,R);

    st[site] = st[site<<1] + st[site<<1|1];
}

int Q(int site,int L,int R,int goal)
{
    if(R == goal) return st[site];

    int mid = (L+R)>>1;

    if(goal <= mid) return Q(site<<1,L,mid,goal);
    return (st[site<<1] + Q(site<<1|1,mid+1,R,goal))%MOD;
}

void U(int site,int L,int R,int goal,int info)
{
    if(L == R)
    {
        st[site] += info;
        return ;
    }

    int mid = (L+R)>>1;

    if(goal <= mid)
        U(site<<1,L,mid,goal,info);
    else
        U(site<<1|1,mid+1,R,goal,info);

    st[site] = st[site<<1] + st[site<<1|1];
}

int main()
{
    int n,k,i,j;
    LL l;
    scanf("%d %I64d %d",&n,&l,&k);

    for(i = 1;i <= n; ++i)
        scanf("%d",&num[i]),tmp[i] = num[i];

    sort(tmp+1,tmp+n+1);

    for(i = 2,j = 1;i <= n; ++i)
        if(tmp[i] != tmp[j]) tmp[++j] = tmp[i];

    int m = j;

    for(i = 1;i <= n; ++i)
        num[i] = lower_bound(tmp+1,tmp+m+1,num[i]) - tmp;

    Init(1,1,m);

    LL anw  = l%MOD;

    k = min((LL)k,l/n + (l%n ? 1 : 0));
  //  cout<<"k = "<<k<<endl;
    for(i = 2;i <= k; ++i)
    {
        for(j = 1;j <= n; ++j)
            tmp[j] = Q(1,1,n,num[j]);

        memset(st,0,sizeof(int)*(m*4+10));

        for(j = 1;j <= n; ++j)
        {
            U(1,1,m,num[j],tmp[j]);

            if(j == l%n)
            {
            //    cout<<st[1]<<endl;
                anw += st[1];
            }
        }

        (anw += st[1]*(l/n - i+1)) %= MOD;
    }

    printf("%I64d\n",anw);

    return 0;
}


#include <iostream>
#include <cstring>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <cmath>
#include <algorithm>
#include <string>

#define LL long long
#define EPS (1e-8)
#define INF  0x3f3f3f
#pragma comment(linker, "/STACK:1024000000,1024000000")

const int MOD = 1000000007;

using namespace std;

template <typename T>

inline void read(T& x)
{
    char ch;
    while (!((((ch=getchar())>='0') && (ch <= '9')) || (ch == '-')));
    x = ch-'0';
    while (((ch=getchar())>='0') && (ch <= '9')) x = x*10+ch-'0';
}

int num[1001000];

int st[4001000];

int tmp[1001000];

void Init(int site,int L,int R)
{
    if(L == R)
    {
        st[site] = 1;
        return ;
    }

    int mid = (L+R)>>1;

    Init(site<<1,L,mid);
    Init(site<<1|1,mid+1,R);

    st[site] = st[site<<1] + st[site<<1|1];
}

int Q(int site,int L,int R,int goal)
{
    if(R == goal) return st[site];

    int mid = (L+R)>>1;

    if(goal <= mid) return Q(site<<1,L,mid,goal);
    return (st[site<<1] + Q(site<<1|1,mid+1,R,goal))%MOD;
}

void U(int site,int L,int R,int goal,int info)
{
    if(L == R)
    {
        (st[site] += info) %= MOD;
        return ;
    }

    int mid = (L+R)>>1;

    if(goal <= mid) U(site<<1,L,mid,goal,info);
    else U(site<<1|1,mid+1,R,goal,info);

    st[site] = (st[site<<1] + st[site<<1|1])%MOD;
}

int main()
{
    int n,k,i,j;
    LL l;
    scanf("%d %I64d %d",&n,&l,&k);

    for(i = 1;i <= n; ++i)
        scanf("%d",&num[i]),tmp[i] = num[i];

    sort(tmp+1,tmp+n+1);

    for(i = 2,j = 1;i <= n; ++i)
        if(tmp[i] != tmp[j]) tmp[++j] = tmp[i];

    int m = j;

    for(i = 1;i <= n; ++i)
        num[i] = lower_bound(tmp+1,tmp+m+1,num[i]) - tmp;

//    for(i = 1;i <= n; ++i)
//        printf("i = %d num = %d\n",i,num[i]);

    memset(st,0,sizeof(int)*(m*4+10));

    for(i = 1;i <= n; ++i)
        U(1,1,m,num[i],1);

    LL anw = l%MOD;

    k = min((LL)k,l/n + (l%n ? 1 : 0));
  //  cout<<"k = "<<k<<endl;
    for(i = 2;i <= k; ++i)
    {
        for(j = 1;j <= n; ++j)
            tmp[j] = Q(1,1,m,num[j]);

        memset(st,0,sizeof(int)*(m*4+10));

        for(j = 1;j <= n; ++j)
        {
            U(1,1,m,num[j],tmp[j]);
         //   cout<<"tmp = "<<tmp[j]<<endl;
            if(j == l%n)
            {
             //   cout<<"i = "<<i<<" "<<"j = "<<j<<" "<<st[1]<<endl;
                (anw += st[1]) %= MOD;
            }
        }

        (anw += (l/n - i+1)%MOD*st[1]) %= MOD;
       // getchar();
    }

    printf("%I64d\n",anw);

    return 0;
}


#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
template<class T> inline T poww(T b,T p){ll a=1;while(p){if(p&1){a=(a*b);}p>>=1;b=(b*b);}return a;}
template<class T> inline T poww2(T b,int p){T a=1;while(p){if(p&1){a=(a*b);}p>>=1;b=(b*b);}return a;}
template<class T> inline T modpoww(T b,T p,T mmod){if(p==0&&b==0)return 0;ll a=1;while(p){if(p&1){a=(a*b)%mmod;}p>>=1;b=(b*b)%mmod;}return a%mmod;}
template<class T>  inline T gcd(T a,T b){ if(b>a)return gcd(b,a);return ((b==0)?a:gcd(b,a%b));}
#define pb push_back
#define mod 1000000007
#define snd(a) scanf("%d",&(a))

int n, k, rr;
ll l;
std::vector<pair<int, int> > a;
vector<int> aa;
int p[1000010];
int *dp[1000010];
int *dp2[1000010];

int solve(int k, int idx)
{
  if(!k) return 1;
  if(idx >= n) return 0;

  if(idx != -1 && dp[k][idx] != -1) return dp[k][idx];
  int i, j;
  ll tans = 0;
  if(idx < 0)
  {
    for(i = 0; i < n; i++)
    {
      tans = (tans + solve(k-1, p[i])) % mod;
    }
    tans = (tans + n) % mod;
    return tans;
  }
  else
  {
    tans = (ll)solve(k-1, p[a[idx].second]) + solve(k, p[a[idx].second] + 1);
    tans %= mod;
  }
  dp[k][idx] = tans;
 //  if(dp.size()>1000500)exit(-1);
  return tans;
}

int solve2(int k, int idx, int level)
{
 //cout<<"K="<<k<<" idx="<<idx<<" level="<<level<<":::\n";
  int i, j;
  if(!k) return 1;
  if(idx >= n) return 0;
  if(level == 1) {
    if (idx == -1) return rr;
    else while(1);
  }
  if(level == 2)
  {
    if(idx == -1) {
      ll tans =0;
      for (i = 0; i < n; i++)
      {
        tans = (tans+  (aa.end() - lower_bound(aa.begin(),aa.end(),a[i].first)))%mod;
      }
      return (tans + n)%mod;
    }
    else {
      ll tans =0;
      for (i = idx; i < n; i++)
      {
        tans = (tans+  (aa.end() - lower_bound(aa.begin(),aa.end(),a[i].first)))%mod;
      }
      return (tans + (n - idx))%mod;
    }
  }

  if(idx != -1 && dp2[k][idx] != -1) return dp2[k][idx];

  ll tans = 0;
  if(idx < 0)
  {
    for(i = 0; i < n; i++)
    {
      tans = (tans + solve2(k-1, p[i], level - 1)) % mod;
    }
    tans = (tans + n) % mod;
    return tans;
  }
  else
  {
    tans = (ll)solve2(k-1, p[a[idx].second], level - 1) + solve2(k, p[a[idx].second] + 1, level);
    tans %= mod;
  }
 // if(dp2.size()>1000500)exit(-1);
 dp2[k][idx] = tans;
  return tans;
}

int main()
{
  int i, j, k;
  cin >> n >> l >> k;

  for (i = 0; i < k+2; i++)
  {
    dp[i] = (int*) malloc(sizeof(int)* (n+1));
    dp2[i] = (int*) malloc(sizeof(int)* (n+1));
    for(j = 0; j < n+1; j++)
    {
      dp[i][j] = dp2[i][j] = -1;
    }
  }
  //if(n>5)while(1);
  ll level = l / n ;
  rr = l % n;
  if (rr) level++;
  int last = (!rr?n:rr);

  for (i = 0; i < n; i++)
  {
    snd(j);
    a.pb(make_pair<int,int>(j,i));
    if(i<last)aa.pb(j);
  }
  sort(aa.begin(), aa.end());

  sort(a.begin(), a.end());
  for (i = 0; i < n; i++)
  {
    p[a[i].second] = i;
    if(i && a[i].first == a[i - 1].first) p[a[i].second] = p[a[i-1].second];
  }

  ll kans = solve(k, -1);

  ll ans = 0;
 // cout<<"l="<<level<<" k="<<k<<"\n";
  if (level > k)
  {
    ans = kans * (level - k);
    ans %= mod;
    level = k;
  }
  j=1;
  if (!rr) rr =n; //last level
 // cout << "ans= " << ans << " rr=" << rr<< "level="<<level << "k="<<k<<"\n";
  for (i = min((ll)k, level); i > 0; i--)
  {
    ans = (ans + solve2(i, -1, i)) % mod;
 //   cout<<"ans="<<ans<<" i="<<i<<"\n";
  }
  cout << ans % mod << endl;

}


#include <iostream>
#include <vector>
#include <algorithm>
typedef long long ll;
using namespace std;
#define mod 1000000007

int dp[2][1000001];// length and level
vector<pair<int,int> > a(1000001);

int main()
{
    int i, j, k, n;
    ll l;
    cin >> n >> l >> k;
    int kk = k;

    for (i = 0; i < n; i++)
    {
        scanf("%d",&a[i].first);
        a[i].second = i;
    }
    sort(a.begin(), a.begin() + n);
    ll ans = 0;
    ll lev = l / n;
    int r = l % n - 1;
    for (i = 0; i < n; i++)
    {
        dp[0][i] = 1;
        ans = (ans + lev);
        if (a[i].second <= r) ans++;
        if(ans >= mod) ans %= mod;
    }
    //cout << "here: ans= " << ans << endl;
    int p = 0;
    ll maxlen = lev;
    if (r > -1) maxlen++;
    for (j = 2; j <= min((ll) k, maxlen); j++)
    {
        if (j > kk) exit(-1);
        p = 1 - p;
        int loc = 0;
        ll sum = 0;
        for (i = 0; i < n; i++)
        {
            while(loc < n && a[loc].first <= a[i].first )
                sum = (sum + dp[!p][loc++]) % mod;
            dp[p][i] = sum;
            ans = (ans + sum * ((lev - j + 1) % mod)) % mod;
            if (a[i].second <= r) ans = (ans + sum) % mod;
            //cout << "sum=" << sum << "ans=" << ans << endl;
        }
    }
    cout << ans % mod << endl;

    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
typedef long long ll;
using namespace std;
#define mod 1000000007

int dp[2][1000001];// length and level
vector<pair<int,int> > a(1000001);

int main()
{
    int i, j, k, n;
    ll l;
    cin >> n >> l >> k;

    for (i = 0; i < n; i++)
    {
        cin >> a[i].first;
        a[i].second = i;
    }
    sort(a.begin(), a.begin() + n);
    ll ans = 0;
    ll lev = l / n;
    int r = l % n - 1;
    for (i = 0; i < n; i++)
    {
        dp[0][i] = 1;
        ans = (ans + lev);
        if (a[i].second <= r) ans++;
        if(ans >= mod) ans %= mod;
    }
    //cout << "here: ans= " << ans << endl;
    int p = 0;
    ll maxlen = lev;
    if (r > -1) maxlen++;
    for (j = 2; j <= min((ll) k, maxlen); j++)
    {
        p = 1 - p;
        int loc = 0;
        ll sum = 0;
        for (i = 0; i < n; i++)
        {
            while(loc < n && a[loc].first <= a[i].first )
                sum = (sum + dp[!p][loc++]) % mod;
            dp[p][i] = sum;
            ans = (ans + sum * ((lev - j + 1) % mod)) % mod;
            if (a[i].second <= r) ans = (ans + sum) % mod;
            //cout << "sum=" << sum << "ans=" << ans << endl;
        }
    }
    cout << ans % mod << endl;

    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
typedef long long ll;
using namespace std;
#define mod 1000000007

int main()
{
    int i, j, k, n;
    ll l;
    cin >> n >> l >> k;
    int dp[2][n];// length and level
    vector<pair<int,int> > a(n);
    for (i = 0; i < n; i++)
    {
        cin >> a[i].first;
        a[i].second = i;
    }
    sort(a.begin(), a.end());
    ll ans = 0;
    ll lev = l / n;
    int r = l % n - 1;
    for (i = 0; i < n; i++)
    {
        dp[0][i] = 1;
        ans = (ans + dp[0][i] * lev) % mod;
        if (a[i].second <= r) ans++;
    }
    //cout << "here: ans= " << ans << endl;
    int p = 0;
    ll maxlen = lev;
    if (r > -1) maxlen++;
    for (j = 2; j <= min((ll) k, maxlen); j++)
    {
        p = 1 - p;
        int loc = 0;
        ll sum = 0;
        for (i = 0; i < n; i++)
        {
            while(loc < n && a[loc].first <= a[i].first )
                sum = (sum + dp[!p][loc++]) % mod;
            dp[p][i] = sum;
            ans = (ans + sum * ((lev - j + 1) % mod)) % mod;
            if (a[i].second <= r) ans = (ans + sum) % mod;
            //cout << "sum=" << sum << "ans=" << ans << endl;
        }
    }
    cout << ans % mod << endl;

    return 0;
}


#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
template<class T> inline T poww(T b,T p){ll a=1;while(p){if(p&1){a=(a*b);}p>>=1;b=(b*b);}return a;}
template<class T> inline T poww2(T b,int p){T a=1;while(p){if(p&1){a=(a*b);}p>>=1;b=(b*b);}return a;}
template<class T> inline T modpoww(T b,T p,T mmod){if(p==0&&b==0)return 0;ll a=1;while(p){if(p&1){a=(a*b)%mmod;}p>>=1;b=(b*b)%mmod;}return a%mmod;}
template<class T>  inline T gcd(T a,T b){ if(b>a)return gcd(b,a);return ((b==0)?a:gcd(b,a%b));}
#define pb push_back
#define mod 1000000007
#define snd(a) scanf("%d",&(a))

int n, k, rr;
ll l;
std::vector<pair<int, int> > a;
vector<int> aa;
int p[1000010];
int *dp[1000010];
int *dp2[1000010];

int solve(int k, int idx)
{
  if(!k) return 1;
  if(idx >= n) return 0;

  if(idx != -1 && dp[k][idx] != -1) return dp[k][idx];
  int i, j;
  ll tans = 0;
  if(idx < 0)
  {
    for(i = 0; i < n; i++)
    {
      tans = (tans + solve(k-1, p[i])) % mod;
    }
    tans = (tans + n) % mod;
    return tans;
  }
  else
  {
    tans = (ll)solve(k-1, p[a[idx].second]) + solve(k, p[a[idx].second] + 1);
    tans %= mod;
  }
  dp[k][idx] = tans;
 //  if(dp.size()>1000500)exit(-1);
  return tans;
}

int solve2(int k, int idx, int level)
{
 // cout<<"K="<<k<<" idx="<<idx<<" level="<<level<<":::\n";
  if(!k) return 1;
  if(idx >= n) return 0;
  if(level == 1) {
    if (idx == -1) return rr;
    return (aa.end() - lower_bound(aa.begin(),aa.end(),a[idx].first));
  }

  if(idx != -1 && dp2[k][idx] != -1) return dp2[k][idx];
  int i, j;
  ll tans = 0;
  if(idx < 0)
  {
    for(i = 0; i < n; i++)
    {
      tans = (tans + solve2(k-1, p[i], level - 1)) % mod;
    }
    tans = (tans + n) % mod;
    return tans;
  }
  else
  {
    tans = (ll)solve2(k-1, p[a[idx].second], level - 1) + solve2(k, p[a[idx].second] + 1, level);
    tans %= mod;
  }
 // if(dp2.size()>1000500)exit(-1);
 dp2[k][idx] = tans;
  return tans;
}

int main()
{
  int i, j, k;
  cin >> n >> l >> k;

  for (i = 0; i < k+2; i++)
  {
    dp[i] = (int*) malloc(sizeof(int)* (n+1));
    dp2[i] = (int*) malloc(sizeof(int)* (n+1));
    for(j = 0; j < n+1; j++)
    {
      dp[i][j] = dp2[i][j] = -1;
    }
  }
  //if(n>5)while(1);
  ll level = l / n ;
  rr = l % n;
  if (rr) level++;
  int last = (!rr?n:rr);

  for (i = 0; i < n; i++)
  {
    snd(j);
    a.pb(make_pair<int,int>(j,i));
    if(i<last)aa.pb(j);
  }
  sort(aa.begin(), aa.end());

  sort(a.begin(), a.end());
  for (i = 0; i < n; i++)
  {
    p[a[i].second] = i;
    if(i && a[i].first == a[i - 1].first) p[a[i].second] = p[a[i-1].second];
  }

  ll kans = solve(k, -1);

  ll ans = 0;
 // cout<<"l="<<level<<" k="<<k<<"\n";
  if (level > k)
  {
    ans = kans * (level - k);
    ans %= mod;
    level = k;
  }
  j=1;
  if (!rr) rr =n; //last level
 // cout << "ans= " << ans << " rr=" << rr<< "level="<<level << "k="<<k<<"\n";
  for (i = min((ll)k, level); i > 0; i--)
  {
    ans = (ans + solve2(i, -1, i)) % mod;
 //   cout<<"ans="<<ans<<" i="<<i<<"\n";
  }
  cout << ans << endl;

}


#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
template<class T> inline T poww(T b,T p){ll a=1;while(p){if(p&1){a=(a*b);}p>>=1;b=(b*b);}return a;}
template<class T> inline T poww2(T b,int p){T a=1;while(p){if(p&1){a=(a*b);}p>>=1;b=(b*b);}return a;}
template<class T> inline T modpoww(T b,T p,T mmod){if(p==0&&b==0)return 0;ll a=1;while(p){if(p&1){a=(a*b)%mmod;}p>>=1;b=(b*b)%mmod;}return a%mmod;}
template<class T>  inline T gcd(T a,T b){ if(b>a)return gcd(b,a);return ((b==0)?a:gcd(b,a%b));}
#define pb push_back
#define mod 1000000007
#define snd(a) scanf("%d",&(a))

int n, k, rr;
ll l;
std::vector<pair<int, int> > a;
vector<int> aa;
int p[1000010];
int *dp[1000010];
int *dp2[1000010];

int solve(int k, int idx)
{
 //  cout<<"k="<<k<<" idx="<<idx<<"\n";
  if(!k) return 0;
  if(idx >= n) return 0;

  if(idx != -1 && dp[k][idx] != -1) return dp[k][idx];
  int i, j;
  ll tans = 0;
  if(idx < 0)
  {
    for(i = 0; i < n; i++)
    {
      tans = (tans + solve(k-1, p[i])) % mod;
    }
    tans = (tans + n) % mod;
    return tans;
  }
  else
  {
    tans = (ll)solve(k-1, idx) + solve(k, idx + 1);
    tans %= mod;
  }
  dp[k][idx] = tans;
 //  if(dp.size()>1000500)exit(-1);
  return tans;
}

int solve2(int k, int idx, int level)
{
 //cout<<"K="<<k<<" idx="<<idx<<" level="<<level<<":::\n";
  int i, j;
  if(!k) return 0;
  if(idx >= n) return 0;
  if(level == 1) {
    if (idx == -1) return rr;
    else while(1);
  }
  if(level == 2)
  {
    if(idx == -1) {
      ll tans =0;
      for (i = 0; i < n; i++)
      {
        tans = (tans+  (aa.end() - lower_bound(aa.begin(),aa.end(),a[i].first)))%mod;
      }
      return (tans + n)%mod;
    }
    else {
      ll tans =0;
      for (i = idx; i < n; i++)
      {
        tans = (tans+  (aa.end() - lower_bound(aa.begin(),aa.end(),a[i].first)))%mod;
      }
      return (tans + (n - idx))%mod;
    }
  }

  if(idx != -1 && dp2[k][idx] != -1) return dp2[k][idx];

  ll tans = 0;
  if(idx < 0)
  {
    for(i = 0; i < n; i++)
    {
      tans = (tans + solve2(k-1, p[i], level - 1)) % mod;
    }
    tans = (tans + n) % mod;
    return tans;
  }
  else
  {
    tans = (ll)solve2(k-1, idx, level - 1) + solve2(k, idx + 1, level);
    tans %= mod;
  }
 // if(dp2.size()>1000500)exit(-1);
 dp2[k][idx] = tans;
  return tans;
}

int main()
{
  int i, j, k;
  cin >> n >> l >> k;

  for (i = 0; i < k+2; i++)
  {
    dp[i] = (int*) malloc(sizeof(int)* (n+1));
    dp2[i] = (int*) malloc(sizeof(int)* (n+1));
    for(j = 0; j < n+1; j++)
    {
      dp[i][j] = dp2[i][j] = -1;
    }
  }
  //if(n>5)while(1);
  ll level = l / n ;
  rr = l % n;
  if (rr) level++;
  int last = (!rr?n:rr);

  for (i = 0; i < n; i++)
  {
    snd(j);
    a.pb(make_pair<int,int>(j,i));
    if(i<last)aa.pb(j);
  }
  sort(aa.begin(), aa.end());

  sort(a.begin(), a.end());
  for (i = 0; i < n; i++)
  {
    p[a[i].second] = i;
    if(i && a[i].first == a[i - 1].first) p[a[i].second] = p[a[i-1].second];
  }

  ll kans = solve(k, -1);

  ll ans = 0;
 //cout<<"l="<<level<<" k="<<k<<" kans="<<kans<<"\n";
  if (level > k)
  {
    ans = kans * (level - k);
    ans %= mod;
    level = k;
  }

  j=1;
  if (!rr) rr =n; //last level
 // cout << "ans= " << ans << " rr=" << rr<< "level="<<level << "k="<<k<<"\n";
  for (i = min((ll)k, level); i > 0; i--)
  {
    ans = (ans + solve2(i, -1, i)) % mod;
 //   cout<<"ans="<<ans<<" i="<<i<<"\n";
  }
  cout << ans % mod << endl;

}


#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
template<class T> inline T poww(T b,T p){ll a=1;while(p){if(p&1){a=(a*b);}p>>=1;b=(b*b);}return a;}
template<class T> inline T poww2(T b,int p){T a=1;while(p){if(p&1){a=(a*b);}p>>=1;b=(b*b);}return a;}
template<class T> inline T modpoww(T b,T p,T mmod){if(p==0&&b==0)return 0;ll a=1;while(p){if(p&1){a=(a*b)%mmod;}p>>=1;b=(b*b)%mmod;}return a%mmod;}
template<class T>  inline T gcd(T a,T b){ if(b>a)return gcd(b,a);return ((b==0)?a:gcd(b,a%b));}
#define pb push_back
#define mod 1000000007
#define snd(a) scanf("%d",&(a))

int n, l, k, rr;
std::vector<pair<int, int> > a;
vector<int> aa;
int p[1000010];
int *dp[1000010];
int *dp2[1000010];

int solve(int k, int idx)
{
  if(!k) return 1;
  if(idx >= n) return 0;

  if(idx != -1 && dp[k][idx] != -1) return dp[k][idx];
  int i, j;
  ll tans = 0;
  if(idx < 0)
  {
    for(i = 0; i < n; i++)
    {
      tans = (tans + solve(k-1, p[i])) % mod;
    }
    tans = (tans + n) % mod;
    return tans;
  }
  else
  {
    tans = (ll)solve(k-1, p[a[idx].second]) + solve(k, p[a[idx].second] + 1);
    tans %= mod;
  }
  dp[k][idx] = tans;
 //  if(dp.size()>1000500)exit(-1);
  return tans;
}

int solve2(int k, int idx, int level)
{
 // cout<<"K="<<k<<" idx="<<idx<<" level="<<level<<":::\n";
  if(!k) return 1;
  if(idx >= n) return 0;
  if(level == 1) {
    if (idx == -1) return rr;
    return (aa.end() - lower_bound(aa.begin(),aa.end(),a[idx].first));
  }

  if(idx != -1 && dp2[k][idx] != -1) return dp2[k][idx];
  int i, j;
  ll tans = 0;
  if(idx < 0)
  {
    for(i = 0; i < n; i++)
    {
      tans = (tans + solve2(k-1, p[i], level - 1)) % mod;
    }
    tans = (tans + n) % mod;
    return tans;
  }
  else
  {
    tans = (ll)solve2(k-1, p[a[idx].second], level - 1) + solve2(k, p[a[idx].second] + 1, level);
    tans %= mod;
  }
 // if(dp2.size()>1000500)exit(-1);
 dp2[k][idx] = tans;
  return tans;
}

int main()
{
  int i, j, k;
  cin >> n >> l >> k;

  for (i = 0; i < k+2; i++)
  {
    dp[i] = (int*) malloc(sizeof(int)* (n+1));
    dp2[i] = (int*) malloc(sizeof(int)* (n+1));
    for(j = 0; j < n+1; j++)
    {
      dp[i][j] = dp2[i][j] = -1;
    }
  }

  int level = l / n ;
  rr = l % n;
  if (rr) level++;
  int last = (!rr?n:rr);

  for (i = 0; i < n; i++)
  {
    snd(j);
    a.pb(make_pair<int,int>(j,i));
    if(i<last)aa.pb(j);
  }
  sort(aa.begin(), aa.end());

  sort(a.begin(), a.end());
  for (i = 0; i < n; i++)
  {
    p[a[i].second] = i;
    if(i && a[i].first == a[i - 1].first) p[a[i].second] = p[a[i-1].second];
  }

  ll kans = solve(k, -1);

  ll ans = 0;
 // cout<<"l="<<level<<" k="<<k<<"\n";
  if (level > k)
  {
    ans = kans * (level - k);
    ans %= mod;
    level = k;
  }
  j=1;
  if (!rr) rr =n; //last level
 // cout << "ans= " << ans << " rr=" << rr<< "level="<<level << "k="<<k<<"\n";
  for (i = min(k, level); i > 0; i--)
  {
    ans = (ans + solve2(i, -1, i)) % mod;
 //   cout<<"ans="<<ans<<" i="<<i<<"\n";
  }
  cout << ans << endl;

}


#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
template<class T> inline T poww(T b,T p){ll a=1;while(p){if(p&1){a=(a*b);}p>>=1;b=(b*b);}return a;}
template<class T> inline T poww2(T b,int p){T a=1;while(p){if(p&1){a=(a*b);}p>>=1;b=(b*b);}return a;}
template<class T> inline T modpoww(T b,T p,T mmod){if(p==0&&b==0)return 0;ll a=1;while(p){if(p&1){a=(a*b)%mmod;}p>>=1;b=(b*b)%mmod;}return a%mmod;}
template<class T>  inline T gcd(T a,T b){ if(b>a)return gcd(b,a);return ((b==0)?a:gcd(b,a%b));}
#define pb push_back
#define mod 1000000007
#define snd(a) scanf("%d",&(a))

int n, l, k, rr;
std::vector<pair<int, int> > a;
vector<int> aa;
int p[1000010];
int *dp[1000010];
int *dp2[1000010];

int solve(int k, int idx)
{
  if(!k) return 1;
  if(idx >= n) return 0;

  if(idx != -1 && dp[k][idx] != -1) return dp[k][idx];
  int i, j;
  ll tans = 0;
  if(idx < 0)
  {
    for(i = 0; i < n; i++)
    {
      tans = (tans + solve(k-1, p[i])) % mod;
    }
    tans = (tans + n) % mod;
    return tans;
  }
  else
  {
    tans = (ll)solve(k-1, p[a[idx].second]) + solve(k, p[a[idx].second] + 1);
    tans %= mod;
  }
  dp[k][idx] = tans;
 //  if(dp.size()>1000500)exit(-1);
  return tans;
}

int solve2(int k, int idx, int level)
{
 // cout<<"K="<<k<<" idx="<<idx<<" level="<<level<<":::\n";
  if(!k) return 1;
  if(idx >= n) return 0;
  if(level == 1) {
    if (idx == -1) return rr;
    return (aa.end() - lower_bound(aa.begin(),aa.end(),a[idx].first));
  }

  if(idx != -1 && dp2[k][idx] != -1) return dp2[k][idx];
  int i, j;
  ll tans = 0;
  if(idx < 0)
  {
    for(i = 0; i < n; i++)
    {
      tans = (tans + solve2(k-1, p[i], level - 1)) % mod;
    }
    tans = (tans + n) % mod;
    return tans;
  }
  else
  {
    tans = (ll)solve2(k-1, p[a[idx].second], level - 1) + solve2(k, p[a[idx].second] + 1, level);
    tans %= mod;
  }
 // if(dp2.size()>1000500)exit(-1);
 dp2[k][idx] = tans;
  return tans;
}

int main()
{
  int i, j, k;
  cin >> n >> l >> k;

  for (i = 0; i < k+2; i++)
  {
    dp[i] = (int*) malloc(sizeof(int)* (n+1));
    dp2[i] = (int*) malloc(sizeof(int)* (n+1));
    for(j = 0; j < n+1; j++)
    {
      dp[i][j] = dp2[i][j] = -1;
    }
  }
  if(n>5)while(1);
  int level = l / n ;
  rr = l % n;
  if (rr) level++;
  int last = (!rr?n:rr);

  for (i = 0; i < n; i++)
  {
    snd(j);
    a.pb(make_pair<int,int>(j,i));
    if(i<last)aa.pb(j);
  }
  sort(aa.begin(), aa.end());

  sort(a.begin(), a.end());
  for (i = 0; i < n; i++)
  {
    p[a[i].second] = i;
    if(i && a[i].first == a[i - 1].first) p[a[i].second] = p[a[i-1].second];
  }

  ll kans = solve(k, -1);

  ll ans = 0;
 // cout<<"l="<<level<<" k="<<k<<"\n";
  if (level > k)
  {
    ans = kans * (level - k);
    ans %= mod;
    level = k;
  }
  j=1;
  if (!rr) rr =n; //last level
 // cout << "ans= " << ans << " rr=" << rr<< "level="<<level << "k="<<k<<"\n";
  for (i = min(k, level); i > 0; i--)
  {
    ans = (ans + solve2(i, -1, i)) % mod;
 //   cout<<"ans="<<ans<<" i="<<i<<"\n";
  }
  cout << ans << endl;

}


#include <iostream>
#include <vector>
#include <algorithm>
typedef long long ll;
using namespace std;
#define mod 1000000007

int main()
{
    int i, j, k, n;
    ll l;
    cin >> n >> l >> k;
    int dp[2][n];// length and level
    vector<pair<int,int> > a(n);
    vector<int> b;
    for (i = 0; i < n; i++)
    {
        cin >> a[i].first;
        a[i].second = i;
        b.push_back(a[i].first);
    }
    sort(a.begin(), a.end());
    ll ans = 0;
    ll lev = l / n;
    int r = l % n - 1;
    for (i = 0; i < n; i++)
    {
        dp[0][i] = 1;
        ans = (ans + dp[0][i] * lev) % mod;
        if (a[i].second <= r) ans++;
    }
    //cout << "here: ans= " << ans << endl;
    int p = 0;
    ll maxlen = lev;
    if (r > -1) maxlen++;
    for (j = 2; j <= min((ll) k, maxlen); j++)
    {
        p = 1 - p;
        int loc = 0;
        ll sum = 0;
        for (i = 0; i < n; i++)
        {
            while(loc < n && a[loc].first <= a[i].first )
                sum = (sum + dp[!p][loc++]) % mod;
            dp[p][i] = sum;
            ans = (ans + sum * (lev - j + 1)) % mod;
            if (a[i].second <= r) ans = (ans + sum) % mod;
            //cout << "sum=" << sum << "ans=" << ans << endl;
        }
    }
    cout << ans % mod << endl;

    return 0;
}


#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
template<class T> inline T poww(T b,T p){ll a=1;while(p){if(p&1){a=(a*b);}p>>=1;b=(b*b);}return a;}
template<class T> inline T poww2(T b,int p){T a=1;while(p){if(p&1){a=(a*b);}p>>=1;b=(b*b);}return a;}
template<class T> inline T modpoww(T b,T p,T mmod){if(p==0&&b==0)return 0;ll a=1;while(p){if(p&1){a=(a*b)%mmod;}p>>=1;b=(b*b)%mmod;}return a%mmod;}
template<class T>  inline T gcd(T a,T b){ if(b>a)return gcd(b,a);return ((b==0)?a:gcd(b,a%b));}
#define pb push_back
#define mod 1000000007
#define snd(a) scanf("%d",&(a))

int n, l, k, rr;
std::vector<pair<int, int> > a;
vector<int> aa;
int p[1000010];
int *dp[1000010];
int *dp2[1000010];

int solve(int k, int idx)
{
  if(!k) return 1;
  if(idx >= n) return 0;

  if(idx != -1 && dp[k][idx] != -1) return dp[k][idx];
  int i, j;
  ll tans = 0;
  if(idx < 0)
  {
    for(i = 0; i < n; i++)
    {
      tans = (tans + solve(k-1, p[i])) % mod;
    }
    tans = (tans + n) % mod;
    return tans;
  }
  else
  {
    tans = (ll)solve(k-1, p[idx]) + solve(k, idx + 1);
    tans %= mod;
  }
  dp[k][idx] = tans;
 //  if(dp.size()>1000500)exit(-1);
  return tans;
}

int solve2(int k, int idx, int level)
{
 // cout<<"K="<<k<<" idx="<<idx<<" level="<<level<<":::\n";
  if(!k) return 1;
  if(idx >= n) return 0;
  if(level == 1) {
    if (idx == -1) return rr;
    return (aa.end() - lower_bound(aa.begin(),aa.end(),a[idx].first));
  }

  if(idx != -1 && dp2[k][idx] != -1) return dp2[k][idx];
  int i, j;
  ll tans = 0;
  if(idx < 0)
  {
    for(i = 0; i < n; i++)
    {
      tans = (tans + solve2(k-1, p[i], level - 1)) % mod;
    }
    tans = (tans + n) % mod;
    return tans;
  }
  else
  {
    tans = (ll)solve2(k-1, p[idx], level - 1) + solve2(k, idx + 1, level);
    tans %= mod;
  }
 // if(dp2.size()>1000500)exit(-1);
 dp2[k][idx] = tans;
  return tans;
}

int main()
{
  int i, j, k;
  cin >> n >> l >> k;

  for (i = 0; i < k+2; i++)
  {
    dp[i] = (int*) malloc(sizeof(int)* (n+1));
    dp2[i] = (int*) malloc(sizeof(int)* (n+1));
    for(j = 0; j < n+1; j++)
    {
      dp[i][j] = dp2[i][j] = -1;
    }
  }

  int level = l / n ;
  rr = l % n;
  if (rr) level++;
  int last = (!rr?n:rr);

  for (i = 0; i < n; i++)
  {
    snd(j);
    a.pb(make_pair<int,int>(j,i));
    if(i<last)aa.pb(j);
  }
  sort(aa.begin(), aa.end());

  sort(a.begin(), a.end());
  for (i = 0; i < n; i++)
  {
    p[a[i].second] = i;
    if(i && a[i].first == a[i - 1].first) p[a[i].second] = p[a[i-1].second];
  }

  ll kans = solve(k, -1);

  ll ans = 0;
 // cout<<"l="<<level<<" k="<<k<<"\n";
  if (level > k)
  {
    ans = kans * (level - k);
    ans %= mod;
    level = k;
  }
  j=1;
  if (!rr) rr =n; //last level
 // cout << "ans= " << ans << " rr=" << rr<< "level="<<level << "k="<<k<<"\n";
  for (i = min(k, level); i > 0; i--)
  {
    ans = (ans + solve2(i, -1, i)) % mod;
 //   cout<<"ans="<<ans<<" i="<<i<<"\n";
  }
  cout << ans << endl;

}


#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
template<class T> inline T poww(T b,T p){ll a=1;while(p){if(p&1){a=(a*b);}p>>=1;b=(b*b);}return a;}
template<class T> inline T poww2(T b,int p){T a=1;while(p){if(p&1){a=(a*b);}p>>=1;b=(b*b);}return a;}
template<class T> inline T modpoww(T b,T p,T mmod){if(p==0&&b==0)return 0;ll a=1;while(p){if(p&1){a=(a*b)%mmod;}p>>=1;b=(b*b)%mmod;}return a%mmod;}
template<class T>  inline T gcd(T a,T b){ if(b>a)return gcd(b,a);return ((b==0)?a:gcd(b,a%b));}
#define pb push_back
#define mod 1000000007
#define snd(a) scanf("%d",&(a))

int n, l, k, rr;
std::vector<pair<int, int> > a;
vector<int> aa;
int p[1000010];
map<pair<int,int>, int> dp;

int solve(int k, int idx)
{
  if(!k) return 1;
  if(idx >= n) return 0;

  if(dp.find(make_pair<int,int>(k,idx)) != dp.end()) return dp[make_pair<int, int>(k, idx)];
  int i, j;
  ll tans = 0;
  if(idx < 0)
  {
    for(i = 0; i < n; i++)
    {
      tans = (tans + solve(k-1, p[i])) % mod;
    }
    tans = (tans + n) % mod;
    return tans;
  }
  else
  {
    tans = (ll)solve(k-1, p[idx]) + solve(k, idx + 1);
    tans %= mod;
  }
  dp[make_pair<int, int>(k, idx)] = tans;
   if(dp.size()>1000500)exit(-1);
  return tans;
}

map<pair<int,int>, int> dp2;

int solve2(int k, int idx, int level)
{
 // cout<<"K="<<k<<" idx="<<idx<<" level="<<level<<":::\n";
  if(!k) return 1;
  if(idx >= n) return 0;
  if(level == 1) {
    if (idx == -1) return rr;
    return (aa.end() - lower_bound(aa.begin(),aa.end(),a[idx].first));
  }

  if(dp2.find(make_pair<int,int>(k,idx)) != dp2.end()) return dp2[make_pair<int, int>(k, idx)];
  int i, j;
  ll tans = 0;
  if(idx < 0)
  {
    for(i = 0; i < n; i++)
    {
      tans = (tans + solve2(k-1, p[i], level - 1)) % mod;
    }
    tans = (tans + n) % mod;
    return tans;
  }
  else
  {
    tans = (ll)solve2(k-1, p[idx], level - 1) + solve2(k, idx + 1, level);
    tans %= mod;
  }
   if(dp2.size()>1000500)exit(-1);
  dp2[make_pair<int, int>(k, idx)] = tans;
  return tans;
}

int main()
{
  int i, j, k;
  cin >> n >> l >> k;

  int level = l / n ;
  rr = l % n;
  if (rr) level++;
  int last = (!rr?n:rr);

  for (i = 0; i < n; i++)
  {
    snd(j);
    a.pb(make_pair<int,int>(j,i));
    if(i<last)aa.pb(j);
  }
  sort(aa.begin(), aa.end());

  sort(a.begin(), a.end());
  for (i = 0; i < n; i++)
  {
    p[a[i].second] = i;
    if(i && a[i].first == a[i - 1].first) p[a[i].second] = p[a[i-1].second];
  }

  ll kans = solve(k, -1);

  ll ans = 0;
 // cout<<"l="<<level<<" k="<<k<<"\n";
  if (level > k)
  {
    ans = kans * (level - k);
    ans %= mod;
    level = k;
  }
  j=1;
  if (!rr) rr =n; //last level
 // cout << "ans= " << ans << " rr=" << rr<< "level="<<level << "k="<<k<<"\n";
  for (i = min(k, level); i > 0; i--)
  {
    ans = (ans + solve2(i, -1, i)) % mod;
 //   cout<<"ans="<<ans<<" i="<<i<<"\n";
  }
  cout << ans << endl;

}


#include <iostream>
#include <vector>
#include <algorithm>
typedef long long ll;
using namespace std;
#define mod 1000000007

int main()
{
	int i, j, k, n;
	ll l;
	cin >> n >> l >> k;
	int dp[2][n];// length and level
	vector<pair<int,int> > a(n);
	vector<int> b;
	for (i = 0; i < n; i++)
	{
		cin >> a[i].first;
		a[i].second = i;
		b.push_back(a[i].first);
	}
	sort(a.begin(), a.end());
	ll ans = 0;
	ll lev = l / n;
	int r = l % n - 1;
	for (i = 0; i < n; i++)
	{
		dp[0][i] = 1;
		ans = (ans + dp[0][i] * lev) % mod;
		if (a[i].second <= r) ans++;
	}
	//cout << "here: ans= " << ans << endl;
	int p = 0;
	ll maxlen = lev;
	if (r > -1) maxlen++;
	for (j = 2; j <= min((ll) k, maxlen); j++)
	{
		p = 1 - p;
		int loc = 0;
		ll sum = 0;
		for (i = 0; i < n; i++)
		{
			while(loc < n && a[loc].first <= a[i].first )
				sum = (sum + dp[!p][loc++]) % mod;
			dp[p][i] = sum;
			ans = (ans + sum * (lev - j + 1)) % mod;
			if (a[i].second <= r) ans = (ans + sum);
			//cout << "sum=" << sum << "ans=" << ans << endl;
		}
	}
	cout << ans % mod << endl;

	return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <stdlib.h>
#include <stdio.h>
typedef long long ll;
using namespace std;
#define mod 1000000007

int dp[2][1000001];// length and level
vector<pair<int,int> > a(1000001);

int main()
{
    int i, j, k, n;
    ll l;
    cin >> n >> l >> k;
    int kk = k;

    for (i = 0; i < n; i++)
    {
        scanf("%d",&a[i].first);
        a[i].second = i;
    }
    sort(a.begin(), a.begin() + n);
    ll ans = 0;
    ll lev = l / n;
    int r = l % n - 1;
    for (i = 0; i < n; i++)
    {
        dp[0][i] = 1;
        ans = (ans + lev);
        if (a[i].second <= r) ans++;
        if(ans >= mod) ans %= mod;
    }
    //cout << "here: ans= " << ans << endl;
    int p = 0;
    ll maxlen = lev;
    if (r > -1) maxlen++;
    for (j = 2; j <= min((ll) k, maxlen); j++)
    {
        if (j > kk) exit(-1);
        p = 1 - p;
        int loc = 0;
        ll sum = 0;
        for (i = 0; i < n; i++)
        {
            while(loc < n && a[loc].first <= a[i].first )
                sum = (sum + dp[!p][loc++]) % mod;
            dp[p][i] = sum;
            ans = (ans + sum * ((lev - j + 1) % mod)) % mod;
            if (a[i].second <= r) ans = (ans + sum) % mod;
            //cout << "sum=" << sum << "ans=" << ans << endl;
        }
    }
    cout << ans % mod << endl;

    return 0;
}


#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
template<class T> inline T poww(T b,T p){ll a=1;while(p){if(p&1){a=(a*b);}p>>=1;b=(b*b);}return a;}
template<class T> inline T poww2(T b,int p){T a=1;while(p){if(p&1){a=(a*b);}p>>=1;b=(b*b);}return a;}
template<class T> inline T modpoww(T b,T p,T mmod){if(p==0&&b==0)return 0;ll a=1;while(p){if(p&1){a=(a*b)%mmod;}p>>=1;b=(b*b)%mmod;}return a%mmod;}
template<class T>  inline T gcd(T a,T b){ if(b>a)return gcd(b,a);return ((b==0)?a:gcd(b,a%b));}
#define pb push_back
#define mod 1000000007
#define snd(a) scanf("%d",&(a))

int n, l, k, rr;
std::vector<pair<int, int> > a;
vector<int> aa;
int p[1000010];
map<pair<int,int>, int> dp;

int solve(int k, int idx)
{
  if(!k) return 1;
  if(idx >= n) return 0;

  if(dp.find(make_pair<int,int>(k,idx)) != dp.end()) return dp[make_pair<int, int>(k, idx)];
  int i, j;
  ll tans = 0;
  if(idx < 0)
  {
    for(i = 0; i < n; i++)
    {
      tans = (tans + solve(k-1, p[i])) % mod;
    }
    tans = (tans + n) % mod;
  }
  else
  {
    tans = (ll)solve(k-1, p[idx]) + solve(k, idx + 1);
    tans %= mod;
  }
  dp[make_pair<int, int>(k, idx)] = tans;
  return tans;
}

map<pair<int,int>, int> dp2;

int solve2(int k, int idx, int level)
{
 // cout<<"K="<<k<<" idx="<<idx<<" level="<<level<<":::\n";
  if(!k) return 1;
  if(idx >= n) return 0;
  if(level == 1) {
    if (idx == -1) return rr;
    return (aa.end() - lower_bound(aa.begin(),aa.end(),a[idx].first));
  }

  if(dp2.find(make_pair<int,int>(k,idx)) != dp2.end()) return dp2[make_pair<int, int>(k, idx)];
  int i, j;
  ll tans = 0;
  if(idx < 0)
  {
    for(i = 0; i < n; i++)
    {
      tans = (tans + solve2(k-1, p[i], level - 1)) % mod;
    }
    tans = (tans + n) % mod;
  }
  else
  {
    tans = (ll)solve2(k-1, p[idx], level - 1) + solve2(k, idx + 1, level);
    tans %= mod;
  }
  dp2[make_pair<int, int>(k, idx)] = tans;
  return tans;
}

int main()
{
  int i, j, k;
  cin >> n >> l >> k;

  int level = l / n ;
  rr = l % n;
  if (rr) level++;
  int last = (!rr?n:rr);

  for (i = 0; i < n; i++)
  {
    snd(j);
    a.pb(make_pair<int,int>(j,i));
    if(i<last)aa.pb(j);
  }
  sort(aa.begin(), aa.end());

  sort(a.begin(), a.end());
  for (i = 0; i < n; i++)
  {
    p[a[i].second] = i;
    if(i && a[i].first == a[i - 1].first) p[a[i].second] = p[a[i-1].second];
  }

  ll kans = solve(k, -1);

  ll ans = 0;
 // cout<<"l="<<level<<" k="<<k<<"\n";
  if (level > k)
  {
    ans = kans * (level - k);
    ans %= mod;
    level = k;
  }
  j=1;
  if (!rr) rr =n; //last level
 // cout << "ans= " << ans << " rr=" << rr<< "level="<<level << "k="<<k<<"\n";
  for (i = min(k, level); i > 0; i--)
  {
    ans = (ans + solve2(i, -1, i)) % mod;
 //   cout<<"ans="<<ans<<" i="<<i<<"\n";
  }
  cout << ans << endl;

}


#include <iostream>
#include <vector>
#include <algorithm>
#include <stdio.h>
typedef long long ll;
using namespace std;
#define mod 1000000007

int main()
{
    int i, j, k, n;
    ll l;
    cin >> n >> l >> k;
    int dp[2][n];// length and level
    vector<pair<int,int> > a(n);
    for (i = 0; i < n; i++)
    {
        scanf("%d",&a[i].first);
        a[i].second = i;
    }
    sort(a.begin(), a.end());
    ll ans = 0;
    ll lev = l / n;
    int r = l % n - 1;
    for (i = 0; i < n; i++)
    {
        dp[0][i] = 1;
        ans = (ans + lev) % mod;
        if (a[i].second <= r) ans++;
    }
    //cout << "here: ans= " << ans << endl;
    int p = 0;
    ll maxlen = lev;
    if (r > -1) maxlen++;
    for (j = 2; j <= min((ll) k, maxlen); j++)
    {
        p = 1 - p;
        int loc = 0;
        ll sum = 0;
        for (i = 0; i < n; i++)
        {
            while(loc < n && a[loc].first <= a[i].first )
                sum = (sum + dp[!p][loc++]) % mod;
            dp[p][i] = sum;
            ans = (ans + sum * ((lev - j + 1) % mod)) % mod;
            if (a[i].second <= r) ans = (ans + sum) % mod;
            //cout << "sum=" << sum << "ans=" << ans << endl;
        }
    }
    cout << ans % mod << endl;

    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
typedef long long ll;
using namespace std;
#define mod 1000000007

int dp[2][1000001];// length and level
vector<pair<int,int> > a(1000001);

int main()
{
    int i, j, k, n;
    ll l;
    cin >> n >> l >> k;

    for (i = 0; i < n; i++)
    {
        cin >> a[i].first;
        a[i].second = i;
    }
    sort(a.begin(), a.begin() + n);
    ll ans = 0;
    ll lev = l / n;
    int r = l % n - 1;
    for (i = 0; i < n; i++)
    {
        dp[0][i] = 1;
        ans = (ans + dp[0][i] * lev) % mod;
        if (a[i].second <= r) ans++;
    }
    //cout << "here: ans= " << ans << endl;
    int p = 0;
    ll maxlen = lev;
    if (r > -1) maxlen++;
    for (j = 2; j <= min((ll) k, maxlen); j++)
    {
        p = 1 - p;
        int loc = 0;
        ll sum = 0;
        for (i = 0; i < n; i++)
        {
            while(loc < n && a[loc].first <= a[i].first )
                sum = (sum + dp[!p][loc++]) % mod;
            dp[p][i] = sum;
            ans = (ans + sum * ((lev - j + 1) % mod)) % mod;
            if (a[i].second <= r) ans = (ans + sum) % mod;
            //cout << "sum=" << sum << "ans=" << ans << endl;
        }
    }
    cout << ans % mod << endl;

    return 0;
}


#include <iostream>
#include <vector>
#include <algorithm>
typedef long long ll;
using namespace std;
#define mod 1000000007

int main()
{
    int i, j, k, n;
    ll l;
    cin >> n >> l >> k;
    int dp[2][n];// length and level
    vector<pair<int,int> > a(n);
    vector<int> b;
    for (i = 0; i < n; i++)
    {
        cin >> a[i].first;
        a[i].second = i;
        b.push_back(a[i].first);
    }
    sort(a.begin(), a.end());
    ll ans = 0;
    ll lev = l / n;
    int r = l % n - 1;
    for (i = 0; i < n; i++)
    {
        dp[0][i] = 1;
        ans = (ans + dp[0][i] * lev) % mod;
        if (a[i].second <= r) ans++;
    }
    //cout << "here: ans= " << ans << endl;
    int p = 0;
    ll maxlen = lev;
    if (r > -1) maxlen++;
    for (j = 2; j <= min((ll) k, maxlen); j++)
    {
        p = 1 - p;
        int loc = 0;
        ll sum = 0;
        for (i = 0; i < n; i++)
        {
            while(loc < n && a[loc].first <= a[i].first )
                sum = (sum + dp[!p][loc++]) % mod;
            dp[p][i] = sum;
            ans = (ans + sum * ((lev - j + 1) % mod)) % mod;
            if (a[i].second <= r) ans = (ans + sum) % mod;
            //cout << "sum=" << sum << "ans=" << ans << endl;
        }
    }
    cout << ans % mod << endl;

    return 0;
}


#include <bits/stdc++.h>
typedef long long ll;
using namespace std;
template<class T> inline T poww(T b,T p){ll a=1;while(p){if(p&1){a=(a*b);}p>>=1;b=(b*b);}return a;}
template<class T> inline T poww2(T b,int p){T a=1;while(p){if(p&1){a=(a*b);}p>>=1;b=(b*b);}return a;}
template<class T> inline T modpoww(T b,T p,T mmod){if(p==0&&b==0)return 0;ll a=1;while(p){if(p&1){a=(a*b)%mmod;}p>>=1;b=(b*b)%mmod;}return a%mmod;}
template<class T>  inline T gcd(T a,T b){ if(b>a)return gcd(b,a);return ((b==0)?a:gcd(b,a%b));}
#define pb push_back
#define mod 1000000007
#define snd(a) scanf("%d",&(a))

int n, k, rr;
ll l;
std::vector<pair<int, int> > a;
vector<int> aa;
int p[1000010];
int *dp[1000010];
int *dp2[1000010];

int solve(int k, int idx)
{
  if(!k) return 0;
  if(idx >= n) return 0;

  if(idx != -1 && dp[k][idx] != -1) return dp[k][idx];
  int i, j;
  ll tans = 0;
  if(idx < 0)
  {
    for(i = 0; i < n; i++)
    {
      tans = (tans + solve(k-1, p[i])) % mod;
    }
    tans = (tans + n) % mod;
    return tans;
  }
  else
  {
    tans = (ll)solve(k-1, p[a[idx].second]) + solve(k, p[a[idx].second] + 1);
    tans %= mod;
  }
  dp[k][idx] = tans;
 //  if(dp.size()>1000500)exit(-1);
  return tans;
}

int solve2(int k, int idx, int level)
{
 //cout<<"K="<<k<<" idx="<<idx<<" level="<<level<<":::\n";
  int i, j;
  if(!k) return 0;
  if(idx >= n) return 0;
  if(level == 1) {
    if (idx == -1) return rr;
    else while(1);
  }
  if(level == 2)
  {
    if(idx == -1) {
      ll tans =0;
      for (i = 0; i < n; i++)
      {
        tans = (tans+  (aa.end() - lower_bound(aa.begin(),aa.end(),a[i].first)))%mod;
      }
      return (tans + n)%mod;
    }
    else {
      ll tans =0;
      for (i = idx; i < n; i++)
      {
        tans = (tans+  (aa.end() - lower_bound(aa.begin(),aa.end(),a[i].first)))%mod;
      }
      return (tans + (n - idx))%mod;
    }
  }

  if(idx != -1 && dp2[k][idx] != -1) return dp2[k][idx];

  ll tans = 0;
  if(idx < 0)
  {
    for(i = 0; i < n; i++)
    {
      tans = (tans + solve2(k-1, p[i], level - 1)) % mod;
    }
    tans = (tans + n) % mod;
    return tans;
  }
  else
  {
    tans = (ll)solve2(k-1, p[a[idx].second], level - 1) + solve2(k, p[a[idx].second] + 1, level);
    tans %= mod;
  }
 // if(dp2.size()>1000500)exit(-1);
 dp2[k][idx] = tans;
  return tans;
}

int main()
{
  int i, j, k;
  cin >> n >> l >> k;

  for (i = 0; i < k+2; i++)
  {
    dp[i] = (int*) malloc(sizeof(int)* (n+1));
    dp2[i] = (int*) malloc(sizeof(int)* (n+1));
    for(j = 0; j < n+1; j++)
    {
      dp[i][j] = dp2[i][j] = -1;
    }
  }
  //if(n>5)while(1);
  ll level = l / n ;
  rr = l % n;
  if (rr) level++;
  int last = (!rr?n:rr);

  for (i = 0; i < n; i++)
  {
    snd(j);
    a.pb(make_pair<int,int>(j,i));
    if(i<last)aa.pb(j);
  }
  sort(aa.begin(), aa.end());

  sort(a.begin(), a.end());
  for (i = 0; i < n; i++)
  {
    p[a[i].second] = i;
    if(i && a[i].first == a[i - 1].first) p[a[i].second] = p[a[i-1].second];
  }

  ll kans = solve(k, -1);

  ll ans = 0;
 //cout<<"l="<<level<<" k="<<k<<" kans="<<kans<<"\n";
  if (level > k)
  {
    ans = kans * (level - k);
    ans %= mod;
    level = k;
  }
  j=1;
  if (!rr) rr =n; //last level
 // cout << "ans= " << ans << " rr=" << rr<< "level="<<level << "k="<<k<<"\n";
  for (i = min((ll)k, level); i > 0; i--)
  {
    ans = (ans + solve2(i, -1, i)) % mod;
 //   cout<<"ans="<<ans<<" i="<<i<<"\n";
  }
  cout << ans % mod << endl;

}


#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <iostream>
#include <map>
#include <iomanip>
#include <stack>
#include <sstream>
#include <queue>
#include <set>
#include <functional>
#include <utility>

#define endl '\n'
#define eps 1e-9
#define ll long long int

const ll MOD = 1000000007;

using namespace std;

pair<int, int> a[1000007];
vector<vector<ll> > dp;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n, k;
	ll l;
	cin >> n >> l >> k;
	dp.resize(k+1, vector<ll>(n, 1));
	ll rem = l%n;
	bool extra = (l <= n*k);
	for (int i = 0; i < n; i++){
		int temp;
		cin >> temp;
		a[i] = make_pair(temp, i);
	}
	sort(a, a+n);
	for (int i = 1; i < k; i++){
		ll sum = 0;
		for (int j = 0; j < n; j++){
			int add = 0;
			while (j+1+add < n && a[j+add].first == a[j+1+add].first){
				sum += dp[i][j+add];
				sum %= MOD;
				add++;
			}
			sum += dp[i][j+add];
			sum %= MOD;
			for (int k = j; k <= j+add; k++)
				dp[i+1][k] = sum;
			j += add;
		}
	}
	ll ret = 0;
	ll divisor = min(1ll*k, l/n);
	for (int i = 1; i <= k; i++){
		bool flag = false;
		if (1ll*i*n > l) flag = true;
		for (int j = 0; j < n; j++){
			//cout << i << ' ' << j << ' ' << dp[i][j] << endl;
			if (!flag){
				ret += (dp[i][j]*(divisor-i+1))%MOD;
				//cout << ret << endl;
				ret %= MOD;
			}
			if (extra && rem && a[j].second < rem){
				ret = (ret+dp[i][j])%MOD;
			}
			//cout << ret << endl;
		}
		if (flag || 1ll*i*n == l) break;
	}
	cout << ret;
}


#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <iostream>
#include <map>
#include <iomanip>
#include <stack>
#include <sstream>
#include <queue>
#include <set>
#include <functional>
#include <utility>

#define endl '\n'
#define eps 1e-9
#define ll long long int

const ll MOD = 1000000007;

using namespace std;

pair<int, int> a[1000007];
vector<vector<ll> > dp;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n, k;
	ll l;
	cin >> n >> l >> k;
	dp.resize(k+1, vector<ll>(n, 1));
	ll rem = l%n;
	for (int i = 0; i < n; i++){
		int temp;
		cin >> temp;
		a[i] = make_pair(temp, i);
	}
	sort(a, a+n);
	for (int i = 1; i < k; i++){
		ll sum = 0;
		for (int j = 0; j < n; j++){
			int add = 0;
			while (j+1+add < n && a[j+add].first == a[j+1+add].first){
				sum += dp[i][j+add];
				sum %= MOD;
				add++;
			}
			sum += dp[i][j+add];
			sum %= MOD;
			for (int k = j; k <= j+add; k++)
				dp[i+1][k] = sum;
			j += add;
		}
	}
	ll ret = 0;
	ll divisor = l/n;
	for (int i = 1; i <= k; i++){
		bool flag = false;
		if (1ll*i*n > l) flag = true;
		for (int j = 0; j < n; j++){
			//cout << i << ' ' << j << ' ' << dp[i][j] << endl;
			if (!flag){
				ret += (dp[i][j]*(divisor-i+1))%MOD;
				//cout << ret << endl;
				ret %= MOD;
			}
			if (rem && a[j].second < rem){
				ret = (ret+dp[i][j])%MOD;
			}
			//cout << ret << endl;
		}
		if (flag || 1ll*i*n == l) break;
	}
	cout << ret;
}


#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <iostream>
#include <map>
#include <iomanip>
#include <stack>
#include <sstream>
#include <queue>
#include <set>
#include <functional>
#include <utility>

#define endl '\n'
#define eps 1e-9
#define ll long long int

const ll MOD = 1000000007;

using namespace std;

pair<int, int> a[1000007];
vector<vector<ll> > dp;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n, k;
	ll l;
	cin >> n >> l >> k;
	dp.resize(k+1, vector<ll>(n, 1));
	ll rem = l%n;
	for (int i = 0; i < n; i++){
		int temp;
		cin >> temp;
		a[i] = make_pair(temp, i);
	}
	sort(a, a+n);
	for (int i = 1; i < k; i++){
		ll sum = 0;
		for (int j = 0; j < n; j++){
			int add = 0;
			while (j+1+add < n && a[j+add].first == a[j+1+add].first){
				sum += dp[i][j+add];
				sum %= MOD;
				add++;
			}
			sum += dp[i][j+add];
			sum %= MOD;
			for (int k = j; k <= j+add; k++)
				dp[i+1][k] = sum;
			j += add;
		}
	}
	ll ret = 0;
	ll divisor = l/n;
	divisor %= MOD;
	for (int i = 1; i <= k && 1ll*i*n <= l; i++){
		for (int j = 0; j < n; j++){
			if (divisor-i+1 < 0) break;
			//cout << i << ' ' << j << ' ' << dp[i][j] << endl;
			ret += (dp[i][j]*(divisor-i+1))%MOD;
			//cout << ret << endl;
			ret %= MOD;
			//cout << ret << endl;
		}
	}
	if (rem){
		for (int i = 1; i <= k && 1ll*(i-1)*n < l; i++){
			for (int j = 0; j < n; j++){
				if (a[j].second < rem){
					ret += dp[i][j];
					ret %= MOD;
				}
			}
		}
	}
	cout << ret;
}


#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <iostream>
#include <map>
#include <iomanip>
#include <stack>
#include <sstream>
#include <queue>
#include <set>
#include <functional>
#include <utility>

#define endl '\n'
#define eps 1e-9
#define ll long long int

const ll MOD = 1000000007;

using namespace std;

pair<int, int> a[1000007];
vector<vector<ll> > dp;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n, k;
	ll l;
	cin >> n >> l >> k;
	dp.resize(k+1, vector<ll>(n, 1));
	ll rem = l%n;
	bool extra = (l <= n*k);
	for (int i = 0; i < n; i++){
		int temp;
		cin >> temp;
		a[i] = make_pair(temp, i);
	}
	sort(a, a+n);
	for (int i = 1; i < k; i++){
		ll sum = 0;
		for (int j = 0; j < n; j++){
			int add = 0;
			while (j+1+add < n && a[j+add].first == a[j+1+add].first){
				sum += dp[i][j+add];
				sum %= MOD;
				add++;
			}
			sum += dp[i][j+add];
			sum %= MOD;
			for (int k = j; k <= j+add; k++)
				dp[i+1][k] = sum;
			j += add;
		}
	}
	ll ret = 0;
	ll divisor = l/n;
	for (int i = 1; i <= k; i++){
		bool flag = false;
		if (1ll*i*n > l) flag = true;
		for (int j = 0; j < n; j++){
			//cout << i << ' ' << j << ' ' << dp[i][j] << endl;
			if (!flag){
				ret += (dp[i][j]*(divisor-i+1))%MOD;
				//cout << ret << endl;
				ret %= MOD;
			}
			if (extra && rem && a[j].second < rem){
				ret = (ret+dp[i][j])%MOD;
			}
			//cout << ret << endl;
		}
		if (flag || 1ll*i*n == l) break;
	}
	cout << ret;
}


#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <iostream>
#include <map>
#include <iomanip>
#include <stack>
#include <sstream>
#include <queue>
#include <set>
#include <functional>
#include <utility>

#define endl '\n'
#define eps 1e-9
#define ll long long int

const ll MOD = 1000000007;

using namespace std;

pair<int, int> a[1000007];
vector<vector<ll> > dp;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n, k;
	ll l;
	cin >> n >> l >> k;
	dp.resize(k+1, vector<ll>(n, 1));
	ll rem = l%n;
	for (int i = 0; i < n; i++){
		int temp;
		cin >> temp;
		a[i] = make_pair(temp, i);
	}
	sort(a, a+n);
	for (int i = 1; i < k; i++){
		ll sum = 0;
		for (int j = 0; j < n; j++){
			int add = 0;
			while (j+1+add < n && a[j+add].first == a[j+1+add].first){
				sum += dp[i][j+add];
				sum %= MOD;
				add++;
			}
			sum += dp[i][j+add];
			sum %= MOD;
			for (int k = j; k <= j+add; k++)
				dp[i+1][k] = sum;
			j += add;
		}
	}
	ll ret = 0;
	ll divisor = l/n;
	for (int i = 1; i <= k && 1ll*i*n <= l; i++){
		for (int j = 0; j < n; j++){
			//cout << i << ' ' << j << ' ' << dp[i][j] << endl;
			ret += (dp[i][j]*((divisor-i+1))%MOD)%MOD;
			//cout << ret << endl;
			ret %= MOD;
			//cout << ret << endl;
		}
	}
	if (rem){
		for (int i = 1; i <= k && 1ll*(i-1)*n < l; i++){
			for (int j = 0; j < n; j++){
				if (a[j].second < rem){
					ret += dp[i][j];
					ret %= MOD;
				}
			}
		}
	}
	cout << ret;
}


#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <iostream>
#include <map>
#include <iomanip>
#include <stack>
#include <sstream>
#include <queue>
#include <set>
#include <functional>
#include <utility>

#define endl '\n'
#define eps 1e-9
#define ll long long int

const ll MOD = 1000000007;

using namespace std;

pair<int, int> a[1000007];
vector<vector<ll> > dp;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n, k;
	ll l;
	cin >> n >> l >> k;
	dp.resize(k+1, vector<ll>(n, 1));
	ll rem = l%n;
	for (int i = 0; i < n; i++){
		int temp;
		cin >> temp;
		a[i] = make_pair(temp, i);
	}
	sort(a, a+n);
	for (int i = 1; i < k; i++){
		ll sum = 0;
		for (int j = 0; j < n; j++){
			int add = 0;
			while (j+1+add < n && a[j+add].first == a[j+1+add].first){
				sum += dp[i][j+add];
				sum %= MOD;
				add++;
			}
			sum += dp[i][j+add];
			sum %= MOD;
			for (int k = j; k <= j+add; k++)
				dp[i+1][k] = sum;
			j += add;
		}
	}
	ll ret = 0;
	ll divisor = l/n;
	divisor %= MOD;
	for (int i = 1; i <= k && 1ll*i*n <= l; i++){
		for (int j = 0; j < n; j++){
			//cout << i << ' ' << j << ' ' << dp[i][j] << endl;
			ret += (dp[i][j]*((divisor-i+1))%MOD)%MOD;
			//cout << ret << endl;
			ret %= MOD;
			//cout << ret << endl;
		}
	}
	if (rem){
		for (int i = 1; i <= k && 1ll*(i-1)*n < l; i++){
			for (int j = 0; j < n; j++){
				if (a[j].second < rem){
					ret += dp[i][j];
					ret %= MOD;
				}
			}
		}
	}
	cout << ret;
}


#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <iostream>
#include <map>
#include <iomanip>
#include <stack>
#include <sstream>
#include <queue>
#include <set>
#include <functional>
#include <utility>

#define endl '\n'
#define eps 1e-9
#define ll long long int

const ll MOD = 1000000007;

using namespace std;

pair<int, int> a[1000007];
vector<vector<ll> > dp;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n, k;
	ll l;
	cin >> n >> l >> k;
	dp.resize(k+1, vector<ll>(n, 1));
	ll rem = l%n;
	for (int i = 0; i < n; i++){
		int temp;
		cin >> temp;
		a[i] = make_pair(temp, i);
	}
	sort(a, a+n);
	for (int i = 1; i < k; i++){
		ll sum = 0;
		for (int j = 0; j < n; j++){
			int add = 0;
			while (j+1+add < n && a[j+add].first == a[j+1+add].first){
				sum += dp[i][j+add];
				sum %= MOD;
				add++;
			}
			sum += dp[i][j+add];
			sum %= MOD;
			for (int k = j; k <= j+add; k++)
				dp[i+1][k] = sum;
			j += add;
		}
	}
	ll ret = 0;
	ll divisor = l/n;
	for (int i = 1; i <= k && 1ll*i*n <= l; i++){
		for (int j = 0; j < n; j++){
			//cout << i << ' ' << j << ' ' << dp[i][j] << endl;
			ret += (dp[i][j]*((divisor-i+1)%MOD))%MOD;
			//cout << ret << endl;
			ret %= MOD;
			//cout << ret << endl;
		}
	}
	if (rem){
		for (int i = 1; i <= k && 1ll*(i-1)*n < l; i++){
			for (int j = 0; j < n; j++){
				if (a[j].second < rem){
					ret += dp[i][j];
					ret %= MOD;
				}
			}
		}
	}
	cout << ret;
}


#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <iostream>
#include <map>
#include <iomanip>
#include <stack>
#include <sstream>
#include <queue>
#include <set>
#include <functional>
#include <utility>

#define endl '\n'
#define eps 1e-9
#define ll long long int

const ll MOD = 1000000007;

using namespace std;

pair<int, int> a[1000007];
vector<vector<ll> > dp;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n, k;
	ll l;
	cin >> n >> l >> k;
	dp.resize(k+1, vector<ll>(n, 1));
	ll rem = l%n;
	for (int i = 0; i < n; i++){
		int temp;
		cin >> temp;
		a[i] = make_pair(temp, i);
	}
	sort(a, a+n);
	for (int i = 1; i < k; i++){
		ll sum = 0;
		for (int j = 0; j < n; j++){
			int add = 0;
			while (j+1+add < n && a[j+add].first == a[j+1+add].first){
				sum += dp[i][j+add];
				sum %= MOD;
				add++;
			}
			sum += dp[i][j+add];
			sum %= MOD;
			for (int k = j; k <= j+add; k++)
				dp[i+1][k] = sum;
			j += add;
		}
	}
	ll ret = 0;
	ll divisor = l/n;
	divisor %= MOD;
	for (int i = 1; i <= k && 1ll*i*n <= l; i++){
		for (int j = 0; j < n; j++){
			//cout << i << ' ' << j << ' ' << dp[i][j] << endl;
			ret += (dp[i][j]*(divisor-i+1))%MOD;
			//cout << ret << endl;
			ret %= MOD;
			//cout << ret << endl;
		}
	}
	if (rem){
		for (int i = 1; i <= k && 1ll*(i-1)*n < l; i++){
			for (int j = 0; j < n; j++){
				if (a[j].second < rem){
					ret += dp[i][j];
					ret %= MOD;
				}
			}
		}
	}
	cout << ret;
}


#include <cstdio>
#include <algorithm>
#include <cmath>
#include <vector>
#include <string>
#include <iostream>
#include <map>
#include <iomanip>
#include <stack>
#include <sstream>
#include <queue>
#include <set>
#include <functional>
#include <utility>

#define endl '\n'
#define eps 1e-9
#define ll long long int

const ll MOD = 1000000007;

using namespace std;

pair<int, int> a[1000007];
vector<vector<ll> > dp;

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(0);
	int n, k;
	ll l;
	cin >> n >> l >> k;
	dp.resize(k+1, vector<ll>(n, 1));
	ll rem = l%n;
	for (int i = 0; i < n; i++){
		int temp;
		cin >> temp;
		a[i] = make_pair(temp, i);
	}
	sort(a, a+n);
	for (int i = 1; i < k; i++){
		ll sum = 0;
		for (int j = 0; j < n; j++){
			int add = 0;
			while (j+1+add < n && a[j+add].first == a[j+1+add].first){
				sum += dp[i][j+add];
				sum %= MOD;
				add++;
			}
			sum += dp[i][j+add];
			sum %= MOD;
			for (int k = j; k <= j+add; k++)
				dp[i+1][k] = sum;
			j += add;
		}
	}
	ll ret = 0;
	ll divisor = l/n;
	for (int i = 1; i <= k && 1ll*i*n <= l; i++){
		for (int j = 0; j < n; j++){
			//cout << i << ' ' << j << ' ' << dp[i][j] << endl;
			ret += (dp[i][j]*(divisor-i+1))%MOD;
			//cout << ret << endl;
			ret %= MOD;
			//cout << ret << endl;
		}
	}
	if (rem){
		for (int i = 1; i <= k && 1ll*(i-1)*n < l; i++){
			for (int j = 0; j < n; j++){
				if (a[j].second < rem){
					ret += dp[i][j];
					ret %= MOD;
				}
			}
		}
	}
	cout << ret;
}


#include <bits/stdc++.h>
using namespace std;
#define md int(1e6+100)
#define modul int(1e9+7)
#define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b ;i++)
#define DOW(i,b,a) for(int i=(b),_a=(a); i>=_a ;i--)
#define pii pair<int,int>
#define ll long long

int n,k;
ll l;
int a[md];
map<int,int> mii;
int t[md+100],c[md],d[md];

int get(int x)
{
	int res=0;
	while (x>0)
	{
		res=(res+t[x])%modul;
		x-=(x&-x);
	}
	return res;
}

void up(int x,int gt)
{
	while (x<=md)
	{
		t[x]=(t[x]+gt)%modul;
		x+=(x&-x);
	}
}

int main()
{
    //freopen("inp.txt","r",stdin);
    scanf("%d%I64d%d",&n,&l,&k);

    FOR(i,1,n)
    {
        scanf("%d",&a[i]);
        mii[a[i]]=1;
    }
    int dem=0;
    for ( typeof(mii.begin()) it= mii.begin(); it !=mii.end(); it++)
    {
        dem++;
        it->second=dem;
    }
    FOR(i,1,n)
    a[i]=mii[a[i]];
    up(1,1);
    ll res=0;
    FOR(i,1,k)
    {
        ll sum=0;
        FOR(x,1,n)
        {
            d[x]=get(a[x]);
            sum=(sum+d[x])%modul;
        }
        if (i!=1) FOR(x,1,n) up(a[x],-c[x]);
        else up(1,-1);
        FOR(x,1,n)
        {
            c[x]=d[x];
            up(a[x],d[x]);
        }
        ll dis=(l/n);
        if (dis>=i) res=(res+((dis-i+1)%modul)*sum)%modul;

        if (dis+1>=i)
        FOR(x,1,l%n)
        res=(res+c[x])%modul;

    }
    cout<<res<<endl;
}


#include <bits/stdc++.h>
using namespace std;
#define md int(1e6+100)
#define modul int(1e9+7)
#define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b ;i++)
#define DOW(i,b,a) for(int i=(b),_a=(a); i>=_a ;i--)
#define pii pair<int,int>
#define ll long long

int n,k;
ll l;
int a[md];
map<int,int> mii;
int t[md+100],c[md],d[md];

int get(int x)
{
	int res=0;
	while (x>0)
	{
		res=(res+t[x])%modul;
		x-=(x&-x);
	}
	return res;
}

void up(int x,int gt)
{
	while (x<=md)
	{
		t[x]=(t[x]+gt)%modul;
		x+=(x&-x);
	}
}

int main()
{
    //freopen("inp.txt","r",stdin);
    scanf("%d%I64d%d",&n,&l,&k);
    FOR(i,1,n)
    {
        scanf("%d",&a[i]);
        mii[a[i]]=1;
    }
    int dem=0;
    for ( typeof(mii.begin()) it= mii.begin(); it !=mii.end(); it++)
    {
        dem++;
        it->second=dem;
    }
    FOR(i,1,n)
    a[i]=mii[a[i]];
    up(1,1);
    ll res=0;
    FOR(i,1,k)
    {
        ll sum=0;
        FOR(x,1,n)
        {
            d[x]=get(a[x]);
            sum=(sum+d[x])%modul;
        }
        if (i!=1) FOR(x,1,n) up(a[x],-c[x]);
        else up(1,-1);
        FOR(x,1,n)
        {
            c[x]=d[x];
            up(a[x],d[x]);
        }
        ll dis=(l/n)%modul;
        if (dis>=i) res=(res+(dis-i+1)*sum)%modul;

        if (dis+1>=i)
        FOR(x,1,l%n)
        res=(res+c[x])%modul;

    }
    cout<<res<<endl;
}


#include <iostream>
#include <vector>
#include <string>
#include <memory.h>
#include <set>
#include <algorithm>
#include <map>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <climits>
#include <cmath>
#include <iomanip>

#define prev wtf0
#define rank wtf1
#define index wtf2
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define endl '\n'
#define dbgv(arr) cout << #arr << ": "; for (int i = 0; i < (int)arr.size(); i++) cout << arr[i] << " "; cout << endl;
#define dbge(el) cout << #el << ": " << el << endl;
#define dbgvv(arr) cout << #arr << ": "; for (int i = 0; i < (int)arr.size(); i++) cout << "(" << arr[i].first << " " << arr[i].second << ") "; cout << endl;
#define sz(s) ((int)(s).size())
#define re return
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> ii;
typedef vector< pair<int, int> > vii;

template<class T> T abs(T x) { return x > 0 ? x : -x; }

const int mod = 1000000007;
const int maxn = 1000000 + 100;
int a[maxn];
ll dp[maxn];

int main()
{
	std::ios::sync_with_stdio(false);
	ll n, l, k;
	cin >> n >> l >> k;

	rep(i, n) {
		cin >> a[i];
		dp[i] = 1;
	}

	ll ans = 0;
	for (int x = 1; x <= k; x++) {
		for (int i = 0; i < n; i++) {
			if (l / n >= x - 1) {
				ans = ans + ll((l / n - x + 1) % mod) * dp[i];
				if (i < l % n)
					ans += dp[i];
			}
		}

		vector< pair<ii, int> > tmp;
		rep(i, n) {
			tmp.pb(mp(mp(a[i], dp[i]), i));
		}
		sort(all(tmp));

		ll sum = 0;
		rep(i, sz(tmp)) {
			int l = i;
			int r = i;

			while (r < n && tmp[r].fi.fi == tmp[l].fi.fi) {
				sum = (sum + tmp[r].fi.se) % mod;
				r++;
			}

			for (int j = l; j < r; j++) {
				dp[tmp[j].se] = sum;
			}

			i = r - 1;
		}
	}

	cout << ans << endl;

	return 0;
}


#include <iostream>
#include <vector>
#include <string>
#include <memory.h>
#include <set>
#include <algorithm>
#include <map>
#include <cstdlib>
#include <cstdio>
#include <queue>
#include <climits>
#include <cmath>
#include <iomanip>

#define prev wtf0
#define rank wtf1
#define index wtf2
#define mp make_pair
#define pb push_back
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define endl '\n'
#define dbgv(arr) cout << #arr << ": "; for (int i = 0; i < (int)arr.size(); i++) cout << arr[i] << " "; cout << endl;
#define dbge(el) cout << #el << ": " << el << endl;
#define dbgvv(arr) cout << #arr << ": "; for (int i = 0; i < (int)arr.size(); i++) cout << "(" << arr[i].first << " " << arr[i].second << ") "; cout << endl;
#define sz(s) ((int)(s).size())
#define re return
#define rep(i, n) for (int i = 0; i < (n); i++)

using namespace std;

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef pair<int, int> ii;
typedef vector< pair<int, int> > vii;

template<class T> T abs(T x) { return x > 0 ? x : -x; }

const int mod = 1000000007;
const int maxn = 1000000 + 100;
int a[maxn];
ll dp[maxn];

int main()
{
	ll n, l, k;
	cin >> n >> l >> k;

	rep(i, n) {
		scanf("%d", &a[i]);
		dp[i] = 1;
	}

	ll ans = 0;
	vector< pair<ii, int> > tmp(n);

	for (int x = 1; x <= k; x++) {
		for (int i = 0; i < n; i++) {
			if (l / n >= x - 1) {
				ans = (ans + (ll((l / n - x + 1) % mod) * dp[i]) % mod) % mod;
				if (i < l % n)
					ans = (ans + dp[i]) % mod;
			}
		}

		rep(i, n) {
			tmp[i] = mp(mp(a[i], dp[i]), i);
		}
		sort(all(tmp));

		ll sum = 0;
		rep(i, sz(tmp)) {
			int l = i;
			int r = i;

			while (r < n && tmp[r].fi.fi == tmp[l].fi.fi) {
				sum = (sum + tmp[r].fi.se) % mod;
				r++;
			}

			for (int j = l; j < r; j++) {
				dp[tmp[j].se] = sum;
			}

			i = r - 1;
		}
	}

	cout << ans << endl;

	return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long LL;

const int N = 1000006;
const int MOD = 1000000007;

int n, k, a[N], x[N], f[N], s[N];
LL l;

struct BIT{
    int t[N];
    BIT(){
        memset( t, 0, sizeof(t));
    }

    void up( int i, int val)
    {
        for( ; i <= n; i += i & (-i))
            t[i] = (t[i] + val) % MOD;
    }

    int get( int i)
    {
        int ans = 0;
        for( ; i >= 1; i -= i & (-i)) ans = (ans + t[i]) % MOD;
        return ans;
    }
} T;

int mul( int a, LL b) {
    if (a <= 1 || b <= 1) return (a * b) % MOD;
    a = a % MOD;
    return (mul( a * 2, b / 2) + a * (b % 2)) % MOD;
}

int main()
{
    ios_base::sync_with_stdio(0);

    cin >> n >> l >> k;
    for(int i = 1; i <= n; i ++) cin >> a[i], x[i] = a[i];

    sort( x + 1, x + n + 1);

    for(int i = 1; i <= n; i ++)
        a[i] = lower_bound( x, x + n, a[i]) - x;

    for(int i = 1; i <= n; i ++) {
        T.up( a[i], 1);
        f[i] = 1;
        s[i] = s[i - 1] + 1;
    }

    for(int j = 2; j <= k ; j ++) {

        for(int i = 1; i <= n; i ++) {
            int p = (j - 1) * n + i;

            f[p] = T.get( a[i]);
            if (p <= l) s[p] = (s[p - 1] + f[p]) % MOD;
            else s[p] = s[l];

        }
        memset( T.t, 0, sizeof( T.t));

        for(int i = 1; i <= n; i ++) {
            int p = (j - 1) * n + i;
            T.up( a[i], f[p]);
        }
    }

    int num = n * k;

    int ans = mul( s[num], max( LL(0), (l / n) - k + 1));

    num = min( l, l % num + (num - n));
    while( num > 0)
    {
        ans = (ans + s[num]) % MOD;
        num -= n;
    }

    cout << ans;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long LL;

const int N = 1000006;
const int MOD = 1000000007;

int n, k, a[N], x[N], f[N], s[N];
LL l;

struct BIT{
    int t[N];
    BIT(){
        memset( t, 0, sizeof(t));
    }

    void up( int i, int val)
    {
        for( ; i <= n; i += i & (-i))
            t[i] = (t[i] + val) % MOD;
    }

    int get( int i)
    {
        int ans = 0;
        for( ; i >= 1; i -= i & (-i)) ans = (ans + t[i]) % MOD;
        return ans;
    }
} T;

int mul( int a, LL b) {
    if (a <= 1 || b <= 1) return (a * b) % MOD;
    a = a % MOD;
    return (mul( a * 2, b / 2) + a * (b % 2)) % MOD;
}

int main()
{
    ios_base::sync_with_stdio(0);

    cin >> n >> l >> k;
    for(int i = 1; i <= n; i ++) cin >> a[i], x[i] = a[i];

    sort( x + 1, x + n + 1);

    for(int i = 1; i <= n; i ++)
        a[i] = lower_bound( x, x + n, a[i]) - x;

    for(int i = 1; i <= n; i ++) {
        T.up( a[i], 1);
        f[i] = 1;
        s[i] = s[i - 1] + 1;
    }

    for(int j = 2; j <= k ; j ++) {

        for(int i = 1; i <= n; i ++) {
            int p = (j - 1) * n + i;

            f[p] = T.get( a[i]);
            if (p <= l) s[p] = (s[p - 1] + f[p]) % MOD;
            else s[p] = s[l];

        }
        memset( T.t, 0, sizeof( T.t));

        for(int i = 1; i <= n; i ++) {
            int p = (j - 1) * n + i;
            T.up( a[i], f[p]);
        }
    }

    int num = n * k;

    int ans = mul( s[num], max( LL(0), (l / n) - k + 1));

    num = l % num + (num - n);
    while( num > 0)
    {
        ans = (ans + s[num]) % MOD;
        num -= n;
    }

    cout << ans;
    return 0;
}


#include <bits/stdc++.h>

using namespace std;

typedef long long LL;

const int N = 1000006;
const int MOD = 1000000007;

int n, k, a[N], x[N], f[N], s[N];
LL l;

struct BIT{
    int t[N];
    BIT(){
        memset( t, 0, sizeof(t));
    }

    void up( int i, int val)
    {
        for( ; i <= n; i += i & (-i))
            t[i] = (t[i] + val) % MOD;
    }

    int get( int i)
    {
        int ans = 0;
        for( ; i >= 1; i -= i & (-i)) ans = (ans + t[i]) % MOD;
        return ans;
    }
} T;

int mul( int a, LL b) {
    if (a <= 1 || b <= 1) return (a * b) % MOD;
    a = a % MOD;
    return (mul( a * 2, b / 2) + a * (b % 2)) % MOD;
}

int main()
{
    ios_base::sync_with_stdio(0);

    cin >> n >> l >> k;
    for(int i = 1; i <= n; i ++) cin >> a[i], x[i] = a[i];

    sort( x + 1, x + n + 1);

    for(int i = 1; i <= n; i ++)
        a[i] = lower_bound( x, x + n, a[i]) - x;

    for(int i = 1; i <= n; i ++) {
        T.up( a[i], 1);
        f[i] = 1;
        s[i] = s[i - 1] + 1;
    }

    for(int j = 2; j <= k ; j ++) {

        for(int i = 1; i <= n; i ++) {
            int p = (j - 1) * n + i;

            f[p] = T.get( a[i]);
            if (p <= l)
            s[p] = (s[p - 1] + f[p]) % MOD;

        }
        memset( T.t, 0, sizeof( T.t));

        for(int i = 1; i <= n; i ++) {
            int p = (j - 1) * n + i;
            T.up( a[i], f[p]);
        }
    }

    int num = n * k;
    if (num > l) s[num] = s[l];

    int ans = mul( s[num], max( LL(0), (l / n) - k + 1));

    num = l % num;
    while( num > 0)
    {
        ans = (ans + s[num]) % MOD;
        num -= n;
    }

    cout << ans;
    return 0;
}


#include <bits/stdc++.h>
#define ii pair< int, int>
#define x first
#define y second
using namespace std;

typedef long long LL;

const int N = 1000006;
const int MOD = 1000000007;

LL l;
int n, k, b[N], S[N], ans;
ii a[N];

int mul( int a, LL b)
{
    if (a <= 1 || b <= 1) return (a * b) % MOD;
    a = a % MOD;
    return (mul( a * 2, b / 2) + a * ( b % 2)) % MOD;
}

int main()
{
    ios_base::sync_with_stdio(0);

    cin >> n >> l >> k;
    for(int i = 1; i <= n; i ++) cin >> a[i].x, a[i].y = i;

    sort( a + 1, a + n + 1);

    for(int i = n; i > 0; i --)
        if (a[i].x == a[i + 1].x) b[i] = b[i + 1] + 1;
        else b[i] = 1;

    for(int i = 1; i <= n; i ++) S[i] = S[i - 1] + 1;

    LL num = ((l - 1) / n) + 1;

    for(int j = 2; j <= k; j ++) {
        for(int i = 1; i <= n; i ++)
        {
            int p = (j - 1) * n + i;
            int tmp = S[p - n + b[i] - 1];
            if (i == 1) S[p] = tmp;
            else S[p] = (S[p - 1] + tmp) % MOD;
            if (a[i].y + (j - 1) * n <= l) {
                LL x = num - j + 1;
                if ( 1ll * (x  + j - 2) * n + a[i].y > l) x --;
                ans = (ans + mul(tmp, x)) % MOD;
            }

        }
    }

    l = l % MOD;

    cout << (ans + l) % MOD;
    return 0;
}


#include <bits/stdc++.h>
#define ii pair< int, int>
#define x first
#define y second
using namespace std;

typedef long long LL;

const int N = 1000006;
const int MOD = 1000000007;

LL l;
int n, k, b[N], S[N], ans;
ii a[N];

int mul( int a, LL b)
{
    if (a <= 1 || b <= 1) return (a * b) % MOD;
    a = a % MOD;
    return (mul( a * 2, b / 2) + a * ( b % 2)) % MOD;
}

int main()
{
    ios_base::sync_with_stdio(0);

    cin >> n >> l >> k;
    for(int i = 1; i <= n; i ++) cin >> a[i].x, a[i].y = i;

    sort( a + 1, a + n + 1);

    for(int i = n; i > 0; i --)
        if (a[i].x == a[i + 1].x) b[i] = b[i + 1] + 1;
        else b[i] = 1;

    for(int i = 1; i <= n; i ++) S[i] = S[i - 1] + 1;

    LL num = ((l - 1) / n) + 1;
    for(int j = 2; j <= k; j ++) {
        for(int i = 1; i <= n; i ++)
        {
            int p = (j - 1) * n + i;
            int tmp = S[p - n + b[i] - 1];
            if (i == 1) S[p] = tmp;
            else S[p] = (S[p - 1] + tmp) % MOD;
            if (a[i].y + (j - 1) * n <= l) {
                LL x = num - j + 1;
                if (a[i].y > l % n) x --;
                ans = (ans + mul(tmp, x)) % MOD;
            }

        }
    }

    l = l % MOD;
    cout << (ans + l) % MOD;
    return 0;
}


#include <bits/stdc++.h>
using namespace std;
const int Mod = int(1e9) + 7;
const int N=1010000;
int n,k,a[N],ans,c[N];
long long l,dp[N],ss[N];
pair<int ,int> p[N];

int main()
{
    scanf("%d%I64d%d",&n,&l,&k);
    for(int i = 0; i < n; ++ i)
    scanf("%d",a+i);
    for(int i = 0; i < (n*k); ++ i)
    p[i]=make_pair(a[i%n],i);
    sort(p,p+n*k);
    for(int j = 0; j < (n*k); ++ j)
    {
        int i=p[j].second;
        if (i<n)
        dp[i]=1;
        else dp[i]=ss[i/n-1];
        ss[i/n]=(ss[i/n]+dp[i])%Mod;
        if (i<l)
        {
            long long x=(l-1-i+n)/n;
            ans=(ans+(x%Mod)*dp[i])%Mod;
        }
    }
    if (ans<0) ans+=Mod;
    printf("%d\n",ans);
}


ì#include <bits/stdc++.h>
using namespace std;
const int Mod = int(1e9) + 7;
const int N=1010000;
int n,k,a[N],ans,c[N];
long long l,dp[N],ss[N];
pair<int ,int> p[N];

int main()
{
    scanf("%d%I64d%d",&n,&l,&k);
    for(int i = 0; i < n; ++ i)
    scanf("%d",a+i);
    for(int i = 0; i < (n*k); ++ i)
    p[i]=make_pair(a[i%n],i);
    sort(p,p+n*k);
    for(int j = 0; j < (n*k); ++ j)
    {
        int i=p[j].second;
        if (i<n)
        dp[i]=1;
        else dp[i]=ss[i/n-1];
        ss[i/n]=(ss[i/n]+dp[i])%Mod;
        if (i<l)
        {
            long long x=(l-1-i+n)/n;
            ans=(ans+(x%Mod)*dp[i])%Mod;
        }
    }
    if (ans<0) ans+=Mod;
    printf("%d\n",ans);
}


#include<bits/stdc++.h>
using namespace std;
const int mod = 1e9+7;
const int lim=1e6+10;
long long m,n;
long long l;
int f[lim];
int g[lim];
long long shengxia;
int need[lim];
vector<long long>sum[lim],sigma[lim];
long long duan;

int main()
{
    //freopen("1.in","r",stdin);
    //freopen("1.out","w",stdout);
    cin>>m>>l>>n;
    for(int i=1;i<=m;i++)
    {
        //cin>>f[i];
        scanf("%d",&f[i]);
    }
    shengxia = l%m;
    for(int i=1;i<=shengxia;i++)
        g[i]=f[i];
    sort(f+1,f+m+1);
    sort(g+1,g+shengxia+1);
    for(int i=1;i<=m;i++)
    {
        need[i-1]=upper_bound(f+1,f+m+1,f[i])-f-2;
    }
    long long pre = l/m;
    long long duan=min((long long)n,(long long)pre+(l%m==0?0:1));
    //cout<<duan<<" "<<shengxia<<" "<<pre<<endl;
    for(int i=0;i<duan;i++)
    {
        int len = i+1;
        for(int j=0;j<m;j++)
        {
            if(len==1)
                sum[len].push_back(1);
            else
                sum[len].push_back(sigma[len-1][need[j]]%mod);
//cout<<"sum["<<len<<"]["<<sum[len].size()-1<<"]="<<sum[len][sum[len].size()-1]<<endl;
            if(j==0)
                sigma[len].push_back(sum[len][j]%mod);
            else
                sigma[len].push_back((sigma[len][j-1]+sum[len][j])%mod);

        }
    }
    long long ans=0;

    for(int i=1;i<=duan&&i<=pre;i++)
        for(int j=0;j<m;j++)
        {
//cout<<" A="<<pre-i+1<<" i="<<i<<" num="<<sum[i][j]<<endl;
                int value=f[i];
                ans=((long long)ans+(long long)(((pre-i+1)%mod)*sum[i][j]%mod))%mod;
//cout<<ans<<endl;
        }
    if(shengxia!=0)
    {
        ans=(ans+shengxia)%mod;
//cout<<"ans="<<ans<<endl;
        for(int i=1;i<=duan-1 && i<=pre;i++)
        {
            for(int j=1;j<=shengxia;j++)
            {
                int value=g[j];
                int pos=upper_bound(f+1,f+m+1,value)-f-2;
//cout<<"pos="<<pos<<endl;
//cout<<g[j]<<" "<<f[pos+1]<<endl;
//cout<<"simga["<<i<<"]["<<pos<<"]="<<sigma[i][pos]<<endl;
//cout<<"value="<<value<<" pos="<<pos<<" sigma="<<sigma[i][pos-1]<<endl;
                ans=((long long)ans+(long long)(sigma[i][pos]))%mod;
//cout<<"i="<<i<<" ans="<<ans<<endl;
            }
        }
    }
    cout<<ans%mod<<endl;
}


#include<bits/stdc++.h>
using namespace std;
const int mod = 1e9+7;
const int lim=1e6+10;
long long m,n;
long long l;
int f[lim];
int g[lim];
long long shengxia;
vector<long long>sum[lim],sigma[lim];
long long duan;

int main()
{
    cin>>m>>l>>n;
    for(int i=1;i<=m;i++)
    {
        scanf("%d",&f[i]);
    }
    shengxia = l%m;
    for(int i=1;i<=shengxia;i++)
        g[i]=f[i];
    sort(f+1,f+m+1);
    sort(g+1,g+shengxia+1);
    long long pre = l/m;
    long long duan=min((long long)n,(long long)pre+(l%m==0?0:1));
    for(int i=0;i<duan;i++)
    {
        int len = i+1;
        for(int j=0;j<m;j++)
        {
            if(len==1)
                sum[len].push_back(1);
            else
                sum[len].push_back(sigma[len-1][j]%mod);

            if(j==0)
                sigma[len].push_back(sum[len][j]%mod);
            else
                sigma[len].push_back((sigma[len][j-1]+sum[len][j])%mod);

        }
    }
    long long ans=0;
    if(shengxia==0)
    {
        for(int i=1;i<=duan;i++)
            for(int j=0;j<m;j++)
            {
                //cout<<" A="<<pre-i+1<<" i="<<i<<" num="<<sum[i][j]<<endl;
                ans=(ans+((pre-i+1)%mod)*sum[i][j]%mod)%mod;
                //cout<<ans<<endl;
            }
    }
    else
    {
        for(int i=1;i<=duan&&i<=pre;i++)
            for(int j=0;j<m;j++)
            {
                ans=(ans+((pre-i+1)%mod)*sum[i][j]%mod)%mod;
            }
        ans=(ans+shengxia)%mod;
        for(int i=1;i<=duan-1 && i<=pre;i++)
        {
            for(int j=1;j<=shengxia;j++)
            {
                int value=g[j];
                int pos=upper_bound(f+1,f+m+1,value)-f-1;
                //cout<<"value="<<value<<" pos="<<pos<<" sigma="<<sigma[i][pos-1]<<endl;
                ans=(ans+sigma[i][pos-1])%mod;
            }
        }
    }
    cout<<ans%mod<<endl;
}


#include<bits/stdc++.h>
using namespace std;
const int mod = 1e9+7;
const int lim=1e6+10;
long long m,n;
long long l;
int f[lim];
int g[lim];
long long shengxia;
int need[lim];
vector<long long>sum[lim],sigma[lim];
long long duan;

int main()
{
    cin>>m>>l>>n;
    for(int i=1;i<=m;i++)
    {
        cin>>f[i];
    }
    shengxia = l%m;
    for(int i=1;i<=shengxia;i++)
        g[i]=f[i];
    sort(f+1,f+m+1);
    sort(g+1,g+shengxia+1);
    for(int i=1;i<=m;i++)
    {
        need[i-1]=upper_bound(f+1,f+m+1,f[i])-f-2;
    }
    long long pre = l/m;
    long long duan=min((long long)n,(long long)pre+(l%m==0?0:1));
    //cout<<duan<<" "<<shengxia<<" "<<pre<<endl;
    for(int i=0;i<duan;i++)
    {
        int len = i+1;
        for(int j=0;j<m;j++)
        {
            if(len==1)
                sum[len].push_back(1);
            else
                sum[len].push_back(sigma[len-1][need[j]]%mod);
//cout<<"sum["<<len<<"]["<<sum[len].size()-1<<"]="<<sum[len][sum[len].size()-1]<<endl;
            if(j==0)
                sigma[len].push_back(sum[len][j]%mod);
            else
                sigma[len].push_back((sigma[len][j-1]+sum[len][j])%mod);

        }
    }
    long long ans=0;

    for(int i=1;i<=duan&&i<=pre;i++)
        for(int j=0;j<m;j++)
        {
//cout<<" A="<<pre-i+1<<" i="<<i<<" num="<<sum[i][j]<<endl;
                int value=f[i];
                ans=((long long)ans+(long long)(((pre-i+1)%mod)*sum[i][j]%mod))%mod;
//cout<<ans<<endl;
        }
    if(shengxia!=0)
    {
        ans=(ans+shengxia)%mod;
//cout<<"ans="<<ans<<endl;
        for(int i=1;i<=duan-1 && i<=pre;i++)
        {
            for(int j=1;j<=shengxia;j++)
            {
                int value=g[j];
                int pos=upper_bound(f+1,f+m+1,value)-f-2;
//cout<<"pos="<<pos<<endl;
//cout<<g[j]<<" "<<f[pos+1]<<endl;
//cout<<"simga["<<i<<"]["<<pos<<"]="<<sigma[i][pos]<<endl;
//cout<<"value="<<value<<" pos="<<pos<<" sigma="<<sigma[i][pos-1]<<endl;
                ans=((long long)ans+(long long)(sigma[i][pos]))%mod;
//cout<<"i="<<i<<" ans="<<ans<<endl;
            }
        }
    }
    cout<<ans%mod<<endl;
}