#include <bits/stdc++.h>
using namespace std;
long long const M = 100 + 10, M2 = 1e7 + 10, mod = 1e9 + 7, inf = 1e18 + 10;
long long a[M];
bool mark[M][M];
long long lis[M], n, t;
struct mat {
  long long dp[M][M];
  mat(long long x) {
    for (long long i = 1; i < M - 5; i++) {
      for (long long j = 1; j < M - 5; j++) {
        dp[i][j] = 0;
      }
    }
    for (long long j = 1; j <= n; j++) dp[j][j] = x;
  }
};
mat ans(0);
void fdp(long long i) {
  for (long long j = 1; j <= n; j++) {
    lis[j] = 0;
    if (a[j] < a[i]) {
      mark[i][j] = 1;
      continue;
    }
    lis[j] = 1;
    for (long long k = 1; k < j; k++) {
      if (a[k] <= a[j]) lis[j] = max(lis[k] + 1, lis[j]);
    }
    ans.dp[i][j] = lis[j];
  }
}
mat operator*(mat &a, mat &b) {
  mat c(0);
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= n; j++) {
      if (mark[i][j]) continue;
      for (long long k = 1; k <= n; k++) {
        if (mark[i][k] || mark[k][j]) continue;
        c.dp[i][j] = max(a.dp[i][k] + b.dp[k][j], c.dp[i][j]);
      }
    }
  }
  return c;
}
mat pw(mat &x, long long y) {
  mat tmp = x;
  mat c(0);
  while (y) {
    if (y % 2 == 1) c = c * tmp;
    tmp = tmp * tmp;
    y /= 2;
  }
  return c;
}
int32_t main() {
  cin >> n >> t;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  for (long long i = 1; i <= n; i++) {
    fdp(i);
  }
  ans = pw(ans, t);
  long long mn = inf, ind;
  long long all = 0;
  for (long long i = 1; i <= n; i++) {
    if (a[i] < mn) mn = a[i], ind = i;
  }
  for (long long i = 1; i <= n; i++) {
    all = max(all, ans.dp[ind][i]);
  }
  cout << all;
}

### Prompt

Your challenge is to write a CPP solution to the following problem:

You are given an array of positive integers a1, a2, ..., an × T of length n × T. We know that for any i > n it is true that ai = ai - n. Find the length of the longest non-decreasing sequence of the given array.

Input

The first line contains two space-separated integers: n, T (1 ≤ n ≤ 100, 1 ≤ T ≤ 107). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 300).

Output

Print a single number — the length of a sought sequence.

Examples

Input

4 3
3 1 4 2


Output

5

Note

The array given in the sample looks like that: 3, 1, 4, 2, 3, 1, 4, 2, 3, 1, 4, 2. The elements in bold form the largest non-decreasing subsequence. 

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
long long const M = 100 + 10, M2 = 1e7 + 10, mod = 1e9 + 7, inf = 1e18 + 10;
long long a[M];
bool mark[M][M];
long long lis[M], n, t;
struct mat {
  long long dp[M][M];
  mat(long long x) {
    for (long long i = 1; i < M - 5; i++) {
      for (long long j = 1; j < M - 5; j++) {
        dp[i][j] = 0;
      }
    }
    for (long long j = 1; j <= n; j++) dp[j][j] = x;
  }
};
mat ans(0);
void fdp(long long i) {
  for (long long j = 1; j <= n; j++) {
    lis[j] = 0;
    if (a[j] < a[i]) {
      mark[i][j] = 1;
      continue;
    }
    lis[j] = 1;
    for (long long k = 1; k < j; k++) {
      if (a[k] <= a[j]) lis[j] = max(lis[k] + 1, lis[j]);
    }
    ans.dp[i][j] = lis[j];
  }
}
mat operator*(mat &a, mat &b) {
  mat c(0);
  for (long long i = 1; i <= n; i++) {
    for (long long j = 1; j <= n; j++) {
      if (mark[i][j]) continue;
      for (long long k = 1; k <= n; k++) {
        if (mark[i][k] || mark[k][j]) continue;
        c.dp[i][j] = max(a.dp[i][k] + b.dp[k][j], c.dp[i][j]);
      }
    }
  }
  return c;
}
mat pw(mat &x, long long y) {
  mat tmp = x;
  mat c(0);
  while (y) {
    if (y % 2 == 1) c = c * tmp;
    tmp = tmp * tmp;
    y /= 2;
  }
  return c;
}
int32_t main() {
  cin >> n >> t;
  for (long long i = 1; i <= n; i++) cin >> a[i];
  for (long long i = 1; i <= n; i++) {
    fdp(i);
  }
  ans = pw(ans, t);
  long long mn = inf, ind;
  long long all = 0;
  for (long long i = 1; i <= n; i++) {
    if (a[i] < mn) mn = a[i], ind = i;
  }
  for (long long i = 1; i <= n; i++) {
    all = max(all, ans.dp[ind][i]);
  }
  cout << all;
}

```