#include <bits/stdc++.h>
using namespace std;
const int X = 305;
const int N = 105;
int n, t, a[N], dp[X], f[X];
int calc(int l, int r, int rep) {
  memset(dp, 0, sizeof dp);
  for (int i = 0; i < n * rep; i++) {
    if (a[i % n] < l || a[i % n] > r) continue;
    int x = a[i % n];
    for (int j = x; j >= l; j--) {
      dp[x] = max(dp[x], dp[j] + 1);
    }
  }
  return *max_element(dp, dp + X);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> t;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    f[a[i]] += 1;
  }
  if (t <= 600) {
    cout << calc(1, 300, t) << '\n';
    return 0;
  }
  long long ans = 0;
  for (int x = 1; x <= 300; x++) {
    if (!f[x]) continue;
    long long can = 0;
    can += calc(1, x, 300) + calc(x, 300, 300);
    can += 1LL * (t - 600) * f[x];
    ans = max(ans, can);
  }
  cout << ans << '\n';
  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>
using namespace std;
const int X = 305;
const int N = 105;
int n, t, a[N], dp[X], f[X];
int calc(int l, int r, int rep) {
  memset(dp, 0, sizeof dp);
  for (int i = 0; i < n * rep; i++) {
    if (a[i % n] < l || a[i % n] > r) continue;
    int x = a[i % n];
    for (int j = x; j >= l; j--) {
      dp[x] = max(dp[x], dp[j] + 1);
    }
  }
  return *max_element(dp, dp + X);
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cin >> n >> t;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    f[a[i]] += 1;
  }
  if (t <= 600) {
    cout << calc(1, 300, t) << '\n';
    return 0;
  }
  long long ans = 0;
  for (int x = 1; x <= 300; x++) {
    if (!f[x]) continue;
    long long can = 0;
    can += calc(1, x, 300) + calc(x, 300, 300);
    can += 1LL * (t - 600) * f[x];
    ans = max(ans, can);
  }
  cout << ans << '\n';
  return 0;
}

```