#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 100;
const long long INF = 1e15;
int N, T, arr[MAX_N + 1];
long long A[MAX_N + 1][MAX_N + 1], B[MAX_N + 1][MAX_N + 1],
    C[MAX_N + 1][MAX_N + 1], ans;
void mul(const long long P[MAX_N + 1][MAX_N + 1],
         const long long Q[MAX_N + 1][MAX_N + 1],
         long long O[MAX_N + 1][MAX_N + 1]) {
  int i, j, k;
  for (i = 1; i <= N; i++) {
    for (j = 1; j <= N; j++) {
      O[i][j] = -INF;
      for (k = 1; k <= N; k++) O[i][j] = max(O[i][j], P[i][k] + Q[k][j]);
    }
  }
}
void copy(const long long P[MAX_N + 1][MAX_N + 1],
          long long O[MAX_N + 1][MAX_N + 1]) {
  int i, j;
  for (i = 1; i <= N; i++) {
    for (j = 1; j <= N; j++) {
      O[i][j] = P[i][j];
    }
  }
}
void process(long long T) {
  while (T) {
    if (T & 1) {
      mul(A, B, C);
      copy(C, B);
    }
    mul(A, A, C);
    copy(C, A);
    T >>= 1;
  }
}
int main() {
  int i, j, k;
  scanf("%d %d", &N, &T);
  for (i = 1; i <= N; i++) scanf("%d", arr + i);
  for (i = 1; i <= N; i++) {
    for (j = 1; j <= N; j++) {
      if (arr[i] > arr[j]) {
        A[i][j] = -INF;
      } else {
        A[i][j] = 1;
        for (k = 1; k < j; k++)
          if (arr[k] <= arr[j]) {
            A[i][j] = max(A[i][j], A[i][k] + 1);
          }
      }
    }
  }
  process(T);
  for (i = 1; i <= N; i++) {
    for (j = 1; j <= N; j++) {
      ans = max(ans, B[i][j]);
    }
  }
  printf("%I64d", 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;
const int MAX_N = 100;
const long long INF = 1e15;
int N, T, arr[MAX_N + 1];
long long A[MAX_N + 1][MAX_N + 1], B[MAX_N + 1][MAX_N + 1],
    C[MAX_N + 1][MAX_N + 1], ans;
void mul(const long long P[MAX_N + 1][MAX_N + 1],
         const long long Q[MAX_N + 1][MAX_N + 1],
         long long O[MAX_N + 1][MAX_N + 1]) {
  int i, j, k;
  for (i = 1; i <= N; i++) {
    for (j = 1; j <= N; j++) {
      O[i][j] = -INF;
      for (k = 1; k <= N; k++) O[i][j] = max(O[i][j], P[i][k] + Q[k][j]);
    }
  }
}
void copy(const long long P[MAX_N + 1][MAX_N + 1],
          long long O[MAX_N + 1][MAX_N + 1]) {
  int i, j;
  for (i = 1; i <= N; i++) {
    for (j = 1; j <= N; j++) {
      O[i][j] = P[i][j];
    }
  }
}
void process(long long T) {
  while (T) {
    if (T & 1) {
      mul(A, B, C);
      copy(C, B);
    }
    mul(A, A, C);
    copy(C, A);
    T >>= 1;
  }
}
int main() {
  int i, j, k;
  scanf("%d %d", &N, &T);
  for (i = 1; i <= N; i++) scanf("%d", arr + i);
  for (i = 1; i <= N; i++) {
    for (j = 1; j <= N; j++) {
      if (arr[i] > arr[j]) {
        A[i][j] = -INF;
      } else {
        A[i][j] = 1;
        for (k = 1; k < j; k++)
          if (arr[k] <= arr[j]) {
            A[i][j] = max(A[i][j], A[i][k] + 1);
          }
      }
    }
  }
  process(T);
  for (i = 1; i <= N; i++) {
    for (j = 1; j <= N; j++) {
      ans = max(ans, B[i][j]);
    }
  }
  printf("%I64d", ans);
  return 0;
}

```