#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const double EPS = 1e-9;
const int N = 5e2 + 9;
int n, t, mem[309][109][109], a[109];
int dp(int p, int i, int e) {
  if (i == e) {
    if (a[i] >= p)
      return 1;
    else
      return -1e5;
  }
  int& ret = mem[p][i][e];
  if (~ret) return ret;
  ret = dp(p, i + 1, e);
  if (a[i] >= p) ret = max(ret, dp(a[i], i + 1, e) + 1);
  return ret;
}
vector<vector<long long> > identity(int n) {
  vector<vector<long long> > id(n, vector<long long>(n, 0));
  for (int i = 0; i <= n - 1; i++) id[i][i] = 0;
  return id;
}
vector<vector<long long> > mul(const vector<vector<long long> >& a,
                               const vector<vector<long long> >& b,
                               long long mod) {
  vector<vector<long long> > c((a).size(), vector<long long>((b)[0].size(), 0));
  for (int i = 0; i <= (a).size() - 1; i++)
    for (int j = 0; j <= (b)[0].size() - 1; j++) {
      c[i][j] = -1e9;
      for (int k = 0; k <= (a)[0].size() - 1; k++) {
        c[i][j] = max(c[i][j], a[i][k] + b[k][j]);
      }
    }
  return c;
}
vector<vector<long long> > matPow(const vector<vector<long long> >& a,
                                  long long po, long long mod) {
  vector<vector<long long> > ret = identity((a).size());
  vector<vector<long long> > m = a;
  while (po) {
    if (po & 1) ret = mul(ret, m, mod);
    m = mul(m, m, mod);
    po >>= 1;
  }
  return ret;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> t;
  for (int i = 1; i <= n; i++) cin >> a[i];
  memset(mem, -1, sizeof mem);
  vector<vector<long long> > m(n, vector<long long>(n, 0));
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      m[i - 1][j - 1] = dp(a[i], 1, j);
      if (m[i - 1][j - 1] <= 0) m[i - 1][j - 1] = -1e9;
    }
  }
  vector<vector<long long> > ans = matPow(m, t, 1e18);
  long long mx = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) mx = max(mx, ans[i][j]);
  cout << mx;
  return 0;
}

### Prompt

Your challenge is to write 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>
#pragma GCC optimize("O3")
using namespace std;
const double EPS = 1e-9;
const int N = 5e2 + 9;
int n, t, mem[309][109][109], a[109];
int dp(int p, int i, int e) {
  if (i == e) {
    if (a[i] >= p)
      return 1;
    else
      return -1e5;
  }
  int& ret = mem[p][i][e];
  if (~ret) return ret;
  ret = dp(p, i + 1, e);
  if (a[i] >= p) ret = max(ret, dp(a[i], i + 1, e) + 1);
  return ret;
}
vector<vector<long long> > identity(int n) {
  vector<vector<long long> > id(n, vector<long long>(n, 0));
  for (int i = 0; i <= n - 1; i++) id[i][i] = 0;
  return id;
}
vector<vector<long long> > mul(const vector<vector<long long> >& a,
                               const vector<vector<long long> >& b,
                               long long mod) {
  vector<vector<long long> > c((a).size(), vector<long long>((b)[0].size(), 0));
  for (int i = 0; i <= (a).size() - 1; i++)
    for (int j = 0; j <= (b)[0].size() - 1; j++) {
      c[i][j] = -1e9;
      for (int k = 0; k <= (a)[0].size() - 1; k++) {
        c[i][j] = max(c[i][j], a[i][k] + b[k][j]);
      }
    }
  return c;
}
vector<vector<long long> > matPow(const vector<vector<long long> >& a,
                                  long long po, long long mod) {
  vector<vector<long long> > ret = identity((a).size());
  vector<vector<long long> > m = a;
  while (po) {
    if (po & 1) ret = mul(ret, m, mod);
    m = mul(m, m, mod);
    po >>= 1;
  }
  return ret;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> t;
  for (int i = 1; i <= n; i++) cin >> a[i];
  memset(mem, -1, sizeof mem);
  vector<vector<long long> > m(n, vector<long long>(n, 0));
  for (int i = 1; i <= n; i++) {
    for (int j = 1; j <= n; j++) {
      m[i - 1][j - 1] = dp(a[i], 1, j);
      if (m[i - 1][j - 1] <= 0) m[i - 1][j - 1] = -1e9;
    }
  }
  vector<vector<long long> > ans = matPow(m, t, 1e18);
  long long mx = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) mx = max(mx, ans[i][j]);
  cout << mx;
  return 0;
}

```