#include <bits/stdc++.h>
using namespace std;
int a[105], n;
vector<vector<int> > multiply(vector<vector<int> > A, vector<vector<int> > B) {
  vector<vector<int> > C(n, vector<int>(n));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      C[i][j] = -100000000;
      for (int k = 0; k < n; k++) C[i][j] = max(C[i][j], A[i][k] + B[k][j]);
    }
  }
  return C;
}
vector<vector<int> > mypow(vector<vector<int> > d, int p) {
  vector<vector<int> > test;
  test.resize(n);
  for (int i = 0; i < n; i++) {
    test[i].resize(n);
  }
  for (; p; p >>= 1) {
    if (p & 1) test = multiply(test, d);
    d = multiply(d, d);
  }
  return test;
}
int main(void) {
  int t;
  while (cin >> n >> t) {
    for (int i = 0; i < n; i++) cin >> a[i];
    vector<vector<int> > d(n, vector<int>(n));
    for (int s = 0; s < n; s++) {
      for (int i = 0; i < n; i++) {
        if (a[i] < a[s])
          d[s][i] = -100000000;
        else {
          d[s][i] = 1;
          for (int j = 0; j < i; j++) {
            if (a[j] <= a[i]) d[s][i] = max(d[s][i], d[s][j] + 1);
          }
        }
      }
    }
    vector<vector<int> > C = mypow(d, t);
    int ans = 0;
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++) ans = max(ans, C[i][j]);
    cout << ans << "\n";
  }
}

### Prompt

Please create a solution in Cpp 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;
int a[105], n;
vector<vector<int> > multiply(vector<vector<int> > A, vector<vector<int> > B) {
  vector<vector<int> > C(n, vector<int>(n));
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < n; j++) {
      C[i][j] = -100000000;
      for (int k = 0; k < n; k++) C[i][j] = max(C[i][j], A[i][k] + B[k][j]);
    }
  }
  return C;
}
vector<vector<int> > mypow(vector<vector<int> > d, int p) {
  vector<vector<int> > test;
  test.resize(n);
  for (int i = 0; i < n; i++) {
    test[i].resize(n);
  }
  for (; p; p >>= 1) {
    if (p & 1) test = multiply(test, d);
    d = multiply(d, d);
  }
  return test;
}
int main(void) {
  int t;
  while (cin >> n >> t) {
    for (int i = 0; i < n; i++) cin >> a[i];
    vector<vector<int> > d(n, vector<int>(n));
    for (int s = 0; s < n; s++) {
      for (int i = 0; i < n; i++) {
        if (a[i] < a[s])
          d[s][i] = -100000000;
        else {
          d[s][i] = 1;
          for (int j = 0; j < i; j++) {
            if (a[j] <= a[i]) d[s][i] = max(d[s][i], d[s][j] + 1);
          }
        }
      }
    }
    vector<vector<int> > C = mypow(d, t);
    int ans = 0;
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++) ans = max(ans, C[i][j]);
    cout << ans << "\n";
  }
}

```