#include <bits/stdc++.h>
using namespace std;
template <typename T>
T nextInt() {
  T x = 0, p = 1;
  char ch;
  do {
    ch = getchar();
  } while (ch <= ' ');
  if (ch == '-') {
    p = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + (ch - '0');
    ch = getchar();
  }
  return x * p;
}
const int maxN = (int)1e6 + 10;
const int INF = (int)1e9;
const int mod = (int)1e9 + 7;
const long long LLINF = (long long)1e18;
vector<int> dps[maxN];
int dp[maxN];
int a[maxN];
int main() {
  srand(time(NULL));
  int n, T;
  cin >> n >> T;
  int t = min(100, T);
  T -= t;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    for (int j = 1; j < t; ++j) {
      a[i + j * n] = a[i];
    }
  }
  for (int i = 0; i < n * t; ++i) {
    dp[i] = 1;
    for (int j = 0; j < i; ++j) {
      if (a[j] <= a[i]) dp[i] = max(dp[i], dp[j] + 1);
    }
    dps[i % n].push_back(dp[i]);
  }
  if (t == 1) {
    cout << *max_element(dp, dp + maxN);
    return 0;
  }
  int res = 0;
  for (int i = 0; i < n; ++i) {
    res = max(res,
              dps[i].back() + T * (dps[i].back() - dps[i][dps[i].size() - 2]));
  }
  cout << res << '\n';
  return 0;
}

### Prompt

Generate 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;
template <typename T>
T nextInt() {
  T x = 0, p = 1;
  char ch;
  do {
    ch = getchar();
  } while (ch <= ' ');
  if (ch == '-') {
    p = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + (ch - '0');
    ch = getchar();
  }
  return x * p;
}
const int maxN = (int)1e6 + 10;
const int INF = (int)1e9;
const int mod = (int)1e9 + 7;
const long long LLINF = (long long)1e18;
vector<int> dps[maxN];
int dp[maxN];
int a[maxN];
int main() {
  srand(time(NULL));
  int n, T;
  cin >> n >> T;
  int t = min(100, T);
  T -= t;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    for (int j = 1; j < t; ++j) {
      a[i + j * n] = a[i];
    }
  }
  for (int i = 0; i < n * t; ++i) {
    dp[i] = 1;
    for (int j = 0; j < i; ++j) {
      if (a[j] <= a[i]) dp[i] = max(dp[i], dp[j] + 1);
    }
    dps[i % n].push_back(dp[i]);
  }
  if (t == 1) {
    cout << *max_element(dp, dp + maxN);
    return 0;
  }
  int res = 0;
  for (int i = 0; i < n; ++i) {
    res = max(res,
              dps[i].back() + T * (dps[i].back() - dps[i][dps[i].size() - 2]));
  }
  cout << res << '\n';
  return 0;
}

```