#include <bits/stdc++.h>
using namespace std;
int arr[500];
int valCnt[500];
int lcs[50000];
int lcsCnt;
int main() {
  int n, t;
  scanf("%d%d", &n, &t);
  int i, tTime = 0, maxValCnt = 0;
  for (i = 1; i <= n; i++) {
    scanf("%d", &arr[i]);
    valCnt[arr[i]]++;
    if (valCnt[arr[i]] > valCnt[maxValCnt]) maxValCnt = arr[i];
  }
  for (tTime = 1; tTime <= t; tTime++) {
    if (tTime > 2 * n) break;
    for (i = 1; i <= n; i++) {
      if (arr[i] >= lcs[lcsCnt]) {
        lcsCnt++;
        lcs[lcsCnt] = arr[i];
      } else {
        int l = 0, r = lcsCnt, mid;
        while (r - l > 0) {
          mid = (l + r + 1) / 2;
          if (arr[i] >= lcs[mid])
            l = mid;
          else
            r = mid - 1;
        }
        mid = (l + r + 1) / 2;
        lcs[mid + 1] = arr[i];
      }
    }
  }
  if (t <= 2 * n)
    printf("%d\n", lcsCnt);
  else
    printf("%d\n", lcsCnt + (t - 2 * n) * valCnt[maxValCnt]);
  return 0;
}

### Prompt

Please formulate 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;
int arr[500];
int valCnt[500];
int lcs[50000];
int lcsCnt;
int main() {
  int n, t;
  scanf("%d%d", &n, &t);
  int i, tTime = 0, maxValCnt = 0;
  for (i = 1; i <= n; i++) {
    scanf("%d", &arr[i]);
    valCnt[arr[i]]++;
    if (valCnt[arr[i]] > valCnt[maxValCnt]) maxValCnt = arr[i];
  }
  for (tTime = 1; tTime <= t; tTime++) {
    if (tTime > 2 * n) break;
    for (i = 1; i <= n; i++) {
      if (arr[i] >= lcs[lcsCnt]) {
        lcsCnt++;
        lcs[lcsCnt] = arr[i];
      } else {
        int l = 0, r = lcsCnt, mid;
        while (r - l > 0) {
          mid = (l + r + 1) / 2;
          if (arr[i] >= lcs[mid])
            l = mid;
          else
            r = mid - 1;
        }
        mid = (l + r + 1) / 2;
        lcs[mid + 1] = arr[i];
      }
    }
  }
  if (t <= 2 * n)
    printf("%d\n", lcsCnt);
  else
    printf("%d\n", lcsCnt + (t - 2 * n) * valCnt[maxValCnt]);
  return 0;
}

```