#include <bits/stdc++.h>
using namespace std;
mt19937 rnd(time(0));
const long long inf = 0x3f3f3f3f3f3f3f3fLL;
const long long N = 110;
const long long MOD = 1e9 + 7;
long long n;
void copy(vector<vector<long long>> a, vector<vector<long long>> &res) {
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) {
      res[i][j] = a[i][j];
    }
  }
}
void mul(vector<vector<long long>> a, vector<vector<long long>> b,
         vector<vector<long long>> &res) {
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) {
      res[i][j] = -inf;
      for (long long k = 0; k < n; k++) {
        res[i][j] = max(res[i][j], a[i][k] + b[k][j]);
      }
    }
  }
}
vector<vector<long long>> t, r, m, res;
void matpow(vector<vector<long long>> a, long long p,
            vector<vector<long long>> &res) {
  copy(a, t);
  while (p) {
    if (p & 1) {
      mul(res, t, r);
      copy(r, res);
    }
    mul(t, t, r);
    copy(r, t);
    p >>= 1;
  }
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long T;
  cin >> n >> T;
  t = vector<vector<long long>>(N, vector<long long>(N));
  r = vector<vector<long long>>(N, vector<long long>(N));
  m = vector<vector<long long>>(N, vector<long long>(N));
  res = vector<vector<long long>>(N, vector<long long>(N));
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) {
      if (a[j] < a[i]) {
        m[i][j] = -inf;
      } else {
        m[i][j] = 1;
        for (long long k = 0; k < j; k++) {
          if (a[k] <= a[j]) {
            m[i][j] = max(m[i][j], m[i][k] + 1);
          }
        }
      }
    }
  }
  matpow(m, T, res);
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) {
      ans = max(ans, res[i][j]);
    }
  }
  cout << ans;
  return 0;
}

### Prompt

In CPP, your task is to solve 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;
mt19937 rnd(time(0));
const long long inf = 0x3f3f3f3f3f3f3f3fLL;
const long long N = 110;
const long long MOD = 1e9 + 7;
long long n;
void copy(vector<vector<long long>> a, vector<vector<long long>> &res) {
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) {
      res[i][j] = a[i][j];
    }
  }
}
void mul(vector<vector<long long>> a, vector<vector<long long>> b,
         vector<vector<long long>> &res) {
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) {
      res[i][j] = -inf;
      for (long long k = 0; k < n; k++) {
        res[i][j] = max(res[i][j], a[i][k] + b[k][j]);
      }
    }
  }
}
vector<vector<long long>> t, r, m, res;
void matpow(vector<vector<long long>> a, long long p,
            vector<vector<long long>> &res) {
  copy(a, t);
  while (p) {
    if (p & 1) {
      mul(res, t, r);
      copy(r, res);
    }
    mul(t, t, r);
    copy(r, t);
    p >>= 1;
  }
}
int32_t main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long T;
  cin >> n >> T;
  t = vector<vector<long long>>(N, vector<long long>(N));
  r = vector<vector<long long>>(N, vector<long long>(N));
  m = vector<vector<long long>>(N, vector<long long>(N));
  res = vector<vector<long long>>(N, vector<long long>(N));
  vector<long long> a(n);
  for (long long i = 0; i < n; i++) cin >> a[i];
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) {
      if (a[j] < a[i]) {
        m[i][j] = -inf;
      } else {
        m[i][j] = 1;
        for (long long k = 0; k < j; k++) {
          if (a[k] <= a[j]) {
            m[i][j] = max(m[i][j], m[i][k] + 1);
          }
        }
      }
    }
  }
  matpow(m, T, res);
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < n; j++) {
      ans = max(ans, res[i][j]);
    }
  }
  cout << ans;
  return 0;
}

```