#include <bits/stdc++.h>
using namespace std;
template <class T>
bool umin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool umax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
int n, t, arr[100009];
class matris {
 public:
  int A[105][105];
  matris() { memset(A, 0, sizeof A); }
  matris operator*(matris B) {
    matris C;
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= n; j++) {
        C[i][j] = -1000000007;
        for (int k = 1; k <= n; k++) {
          C[i][j] = max(C[i][j], A[i][k] + B[k][j]);
        }
      }
    return C;
  }
  int* operator[](int x) { return A[x]; }
};
matris once(matris x, int y) {
  if (y == 1) return x;
  matris z = once(x, y / 2);
  z = z * z;
  if (y & 1) z = z * x;
  return z;
}
int main() {
  scanf("%d%d", &n, &t);
  for (int i = 1; i <= n; i++) scanf("%d", arr + i);
  matris dp;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) {
      dp[i][j] = -1000000007;
      if (arr[i] <= arr[j]) {
        dp[i][j] = 1;
        for (int k = 1; k < j; k++)
          if (arr[j] >= arr[k]) umax(dp[i][j], dp[i][k] + 1);
      }
    }
  dp = once(dp, t);
  int ans = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) umax(ans, dp[i][j]);
  printf("%d\n", ans);
  return 0;
}

### Prompt

Please provide a Cpp coded solution to the problem described below:

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;
template <class T>
bool umin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool umax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
int n, t, arr[100009];
class matris {
 public:
  int A[105][105];
  matris() { memset(A, 0, sizeof A); }
  matris operator*(matris B) {
    matris C;
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= n; j++) {
        C[i][j] = -1000000007;
        for (int k = 1; k <= n; k++) {
          C[i][j] = max(C[i][j], A[i][k] + B[k][j]);
        }
      }
    return C;
  }
  int* operator[](int x) { return A[x]; }
};
matris once(matris x, int y) {
  if (y == 1) return x;
  matris z = once(x, y / 2);
  z = z * z;
  if (y & 1) z = z * x;
  return z;
}
int main() {
  scanf("%d%d", &n, &t);
  for (int i = 1; i <= n; i++) scanf("%d", arr + i);
  matris dp;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) {
      dp[i][j] = -1000000007;
      if (arr[i] <= arr[j]) {
        dp[i][j] = 1;
        for (int k = 1; k < j; k++)
          if (arr[j] >= arr[k]) umax(dp[i][j], dp[i][k] + 1);
      }
    }
  dp = once(dp, t);
  int ans = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++) umax(ans, dp[i][j]);
  printf("%d\n", ans);
  return 0;
}

```