#include <bits/stdc++.h>
using namespace std;
const int N = 105;
const int INF = 1e9;
typedef int mat[N][N];
int n, t;
int a[N];
void init(mat p) {
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) p[i][j] = 0;
}
void copy(mat p, mat q) {
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) q[i][j] = p[i][j];
}
void mul(mat p, mat q, mat r) {
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      r[i][j] = -INF;
      for (int k = 0; k < n; k++) r[i][j] = max(r[i][j], p[i][k] + q[k][j]);
    }
  }
}
void binary_pow(mat p, int t, mat ans) {
  mat z, r;
  init(ans);
  copy(p, z);
  while (t) {
    if (t % 2) {
      mul(ans, z, r);
      copy(r, ans);
    }
    mul(z, z, r);
    copy(r, z);
    t /= 2;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> t;
  for (int i = 0; i < n; i++) cin >> a[i];
  mat p;
  for (int k = 0; k < n; k++) {
    for (int i = 0; i < n; i++) {
      if (a[i] < a[k])
        p[k][i] = -INF;
      else {
        p[k][i] = 1;
        for (int j = 0; j < i; j++)
          if (a[j] <= a[i]) p[k][i] = max(p[k][i], p[k][j] + 1);
      }
    }
  }
  mat ans;
  binary_pow(p, t, ans);
  int res = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) res = max(res, ans[i][j]);
  cout << res;
  return 0;
}

### Prompt

Generate 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;
const int N = 105;
const int INF = 1e9;
typedef int mat[N][N];
int n, t;
int a[N];
void init(mat p) {
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) p[i][j] = 0;
}
void copy(mat p, mat q) {
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) q[i][j] = p[i][j];
}
void mul(mat p, mat q, mat r) {
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      r[i][j] = -INF;
      for (int k = 0; k < n; k++) r[i][j] = max(r[i][j], p[i][k] + q[k][j]);
    }
  }
}
void binary_pow(mat p, int t, mat ans) {
  mat z, r;
  init(ans);
  copy(p, z);
  while (t) {
    if (t % 2) {
      mul(ans, z, r);
      copy(r, ans);
    }
    mul(z, z, r);
    copy(r, z);
    t /= 2;
  }
}
int main() {
  ios_base::sync_with_stdio(false);
  cin >> n >> t;
  for (int i = 0; i < n; i++) cin >> a[i];
  mat p;
  for (int k = 0; k < n; k++) {
    for (int i = 0; i < n; i++) {
      if (a[i] < a[k])
        p[k][i] = -INF;
      else {
        p[k][i] = 1;
        for (int j = 0; j < i; j++)
          if (a[j] <= a[i]) p[k][i] = max(p[k][i], p[k][j] + 1);
      }
    }
  }
  mat ans;
  binary_pow(p, t, ans);
  int res = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) res = max(res, ans[i][j]);
  cout << res;
  return 0;
}

```