#include <bits/stdc++.h>
using namespace std;
int a[105], cnt[305];
int ans = 0;
int lis[305], rlis[305];
int main() {
  int n, T;
  cin >> n >> T;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    cnt[a[i]]++;
  }
  if (T < 4 * n) {
    int nn = n * T;
    for (int i = 0, id = 0; i < nn; ++i, id++) {
      if (id == n) id = 0;
      for (int j = a[id]; j >= 0; --j) lis[a[id]] = max(lis[a[id]], lis[j] + 1);
    }
    int ans = 0;
    for (int i = 0; i < 305; ++i) ans = max(ans, lis[i]);
    cout << ans << endl;
    return 0;
  }
  int nn = 2 * n * n;
  for (int i = 0, id = 0; i < nn; ++i, id++) {
    if (id == n) id = 0;
    for (int j = a[id]; j >= 0; --j) lis[a[id]] = max(lis[a[id]], lis[j] + 1);
  }
  reverse(a, a + n);
  for (int i = 0, id = 0; i < nn; ++i, id++) {
    if (id == n) id = 0;
    for (int j = a[id]; j < 305; ++j)
      rlis[a[id]] = max(rlis[a[id]], rlis[j] + 1);
  }
  int ans = 0;
  T -= 4 * n;
  for (int i = 0; i < 305; ++i) {
    ans = max(ans, lis[i] + rlis[i] + cnt[i] * T);
  }
  cout << ans << endl;
  return 0;
}

### Prompt

Develop a solution in cpp to the problem described below:

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], cnt[305];
int ans = 0;
int lis[305], rlis[305];
int main() {
  int n, T;
  cin >> n >> T;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    cnt[a[i]]++;
  }
  if (T < 4 * n) {
    int nn = n * T;
    for (int i = 0, id = 0; i < nn; ++i, id++) {
      if (id == n) id = 0;
      for (int j = a[id]; j >= 0; --j) lis[a[id]] = max(lis[a[id]], lis[j] + 1);
    }
    int ans = 0;
    for (int i = 0; i < 305; ++i) ans = max(ans, lis[i]);
    cout << ans << endl;
    return 0;
  }
  int nn = 2 * n * n;
  for (int i = 0, id = 0; i < nn; ++i, id++) {
    if (id == n) id = 0;
    for (int j = a[id]; j >= 0; --j) lis[a[id]] = max(lis[a[id]], lis[j] + 1);
  }
  reverse(a, a + n);
  for (int i = 0, id = 0; i < nn; ++i, id++) {
    if (id == n) id = 0;
    for (int j = a[id]; j < 305; ++j)
      rlis[a[id]] = max(rlis[a[id]], rlis[j] + 1);
  }
  int ans = 0;
  T -= 4 * n;
  for (int i = 0; i < 305; ++i) {
    ans = max(ans, lis[i] + rlis[i] + cnt[i] * T);
  }
  cout << ans << endl;
  return 0;
}

```