#include <bits/stdc++.h>
char _;
using namespace std;
const int MAXN = 101;
int T;
int N, flag, flag2, lcount, maxi;
int dp[303], seq[MAXN];
int ans;
vector<int> B;
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin >> N >> T;
  for (int i = 1; i <= N; i++) {
    cin >> seq[i];
    if (maxi < seq[i]) {
      maxi = seq[i];
      lcount = 1;
    } else if (maxi == seq[i]) {
      lcount++;
    }
  }
  for (int it = 1; it <= min(N, T); it++) {
    for (int i = 1; i <= N; i++) {
      int curr = seq[i];
      int best = 0;
      for (int j = 1; j <= curr; j++) best = max(best, dp[j]);
      dp[curr] = best + 1;
      ans = max(ans, dp[curr]);
    }
  }
  int old = ans;
  for (int i = 1; i <= N; i++) {
    int curr = seq[i];
    int best = 0;
    for (int j = 1; j <= curr; j++) best = max(best, dp[j]);
    dp[curr] = best + 1;
    ans = max(ans, dp[curr]);
  }
  int diff = ans - old;
  if (T <= N)
    cout << old << endl;
  else {
    cout << old + (T - N) * diff << endl;
  }
}

### Prompt

Please create a solution in Cpp 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>
char _;
using namespace std;
const int MAXN = 101;
int T;
int N, flag, flag2, lcount, maxi;
int dp[303], seq[MAXN];
int ans;
vector<int> B;
int main() {
  cin.sync_with_stdio(0);
  cin.tie(0);
  cin >> N >> T;
  for (int i = 1; i <= N; i++) {
    cin >> seq[i];
    if (maxi < seq[i]) {
      maxi = seq[i];
      lcount = 1;
    } else if (maxi == seq[i]) {
      lcount++;
    }
  }
  for (int it = 1; it <= min(N, T); it++) {
    for (int i = 1; i <= N; i++) {
      int curr = seq[i];
      int best = 0;
      for (int j = 1; j <= curr; j++) best = max(best, dp[j]);
      dp[curr] = best + 1;
      ans = max(ans, dp[curr]);
    }
  }
  int old = ans;
  for (int i = 1; i <= N; i++) {
    int curr = seq[i];
    int best = 0;
    for (int j = 1; j <= curr; j++) best = max(best, dp[j]);
    dp[curr] = best + 1;
    ans = max(ans, dp[curr]);
  }
  int diff = ans - old;
  if (T <= N)
    cout << old << endl;
  else {
    cout << old + (T - N) * diff << endl;
  }
}

```