#include <bits/stdc++.h>
using namespace std;
const int N = 100;
int A[N], dp[N][N + 1], freq[3 * N + 1];
bool solve(int testNumber) {
  int n, t;
  if (scanf("%d%d", &n, &t) == EOF) return false;
  for (int i = 1; i <= 3 * N; i++) freq[i] = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &A[i]);
    freq[A[i]]++;
  }
  for (int j = 1; j <= n; j++)
    for (int i = 0; i < n; i++) {
      dp[i][j] = j == 1 ? 1 : dp[i][j - 1] + 1;
      for (int k = (j == 1) ? 0 : (i + 1) % n; k != i; k = (k + 1) % n)
        if (A[k] <= A[i])
          dp[i][j] = max(dp[i][j], dp[k][k < i ? j : j - 1] + 1);
    }
  int ret = 0;
  for (int i = 1; i <= min(n, t); i++)
    for (int j = 0; j < n; j++) {
      int maxi = 0;
      for (int k = 1; k <= A[j]; k++) maxi = max(maxi, freq[k]);
      ret = max(ret, dp[j][i] + maxi * (t - i));
    }
  printf("%d\n", ret);
  return true;
}
int main() {
  for (int i = 1; solve(i); i++)
    ;
  return 0;
}

### Prompt

Construct a CPP code solution to the problem outlined:

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;
const int N = 100;
int A[N], dp[N][N + 1], freq[3 * N + 1];
bool solve(int testNumber) {
  int n, t;
  if (scanf("%d%d", &n, &t) == EOF) return false;
  for (int i = 1; i <= 3 * N; i++) freq[i] = 0;
  for (int i = 0; i < n; i++) {
    scanf("%d", &A[i]);
    freq[A[i]]++;
  }
  for (int j = 1; j <= n; j++)
    for (int i = 0; i < n; i++) {
      dp[i][j] = j == 1 ? 1 : dp[i][j - 1] + 1;
      for (int k = (j == 1) ? 0 : (i + 1) % n; k != i; k = (k + 1) % n)
        if (A[k] <= A[i])
          dp[i][j] = max(dp[i][j], dp[k][k < i ? j : j - 1] + 1);
    }
  int ret = 0;
  for (int i = 1; i <= min(n, t); i++)
    for (int j = 0; j < n; j++) {
      int maxi = 0;
      for (int k = 1; k <= A[j]; k++) maxi = max(maxi, freq[k]);
      ret = max(ret, dp[j][i] + maxi * (t - i));
    }
  printf("%d\n", ret);
  return true;
}
int main() {
  for (int i = 1; solve(i); i++)
    ;
  return 0;
}

```