#include <bits/stdc++.h>
using namespace std;
int a[100010], b[100010], f[100010];
int solve(int m) {
  int i, k, l, r, mid;
  a[1] = b[1], k = 1;
  for (i = 2; i <= m; i++) {
    if (a[k] <= b[i])
      a[++k] = b[i];
    else {
      l = 1;
      r = k;
      while (l <= r) {
        mid = (l + r) / 2;
        if (a[mid] <= b[i])
          l = mid + 1;
        else
          r = mid - 1;
      }
      a[l] = b[i];
    }
  }
  return k;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int i, j, t, n, m, k, mx = 0, ct = 0;
  cin >> n >> t;
  for (i = 1; i < n + 1; i++) {
    cin >> b[i];
    f[b[i]]++;
    if (f[b[i]] >= f[mx]) {
      mx = b[i];
    }
  }
  k = 0;
  for (i = 1; i < n && i < t; i++) {
    k += n;
    for (j = 1; j <= n; j++) {
      b[k + j] = b[j];
    }
  }
  m = n * min(n, t);
  int ans = solve(m);
  long long fin = (long long)ans;
  fin = fin + (long long)(t - min(t, n)) * (long long)(f[mx]);
  cout << fin << endl;
  return 0;
}

### Prompt

Please provide a Cpp coded solution 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[100010], b[100010], f[100010];
int solve(int m) {
  int i, k, l, r, mid;
  a[1] = b[1], k = 1;
  for (i = 2; i <= m; i++) {
    if (a[k] <= b[i])
      a[++k] = b[i];
    else {
      l = 1;
      r = k;
      while (l <= r) {
        mid = (l + r) / 2;
        if (a[mid] <= b[i])
          l = mid + 1;
        else
          r = mid - 1;
      }
      a[l] = b[i];
    }
  }
  return k;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int i, j, t, n, m, k, mx = 0, ct = 0;
  cin >> n >> t;
  for (i = 1; i < n + 1; i++) {
    cin >> b[i];
    f[b[i]]++;
    if (f[b[i]] >= f[mx]) {
      mx = b[i];
    }
  }
  k = 0;
  for (i = 1; i < n && i < t; i++) {
    k += n;
    for (j = 1; j <= n; j++) {
      b[k + j] = b[j];
    }
  }
  m = n * min(n, t);
  int ans = solve(m);
  long long fin = (long long)ans;
  fin = fin + (long long)(t - min(t, n)) * (long long)(f[mx]);
  cout << fin << endl;
  return 0;
}

```