#include <bits/stdc++.h>
using namespace std;
int a[100001];
int f[100001];
int s[301];
inline int find(int l, int r, int x) {
  while (l <= r) {
    int mid = (l + r) / 2;
    if (x >= f[mid])
      l = mid + 1;
    else
      r = mid - 1;
  }
  return r;
}
int main() {
  int n, T;
  scanf("%d%d", &n, &T);
  int i, j;
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (i = 1; i <= min(n, T); i++) {
    for (j = 1; j <= n; j++) a[i * n + j] = a[j];
  }
  int lim = n * min(n, T);
  int len = 1;
  f[1] = a[1];
  for (i = 2; i <= lim; i++) {
    int x = find(0, len, a[i]);
    if (x == len) len++;
    f[x + 1] = a[i];
  }
  if (T <= n)
    printf("%d\n", len);
  else {
    int maxx = 0, maxi = 0;
    for (i = 1; i <= n; i++) s[a[i]]++;
    for (i = 1; i <= 300; i++) maxi = max(s[i], maxi);
    printf("%d\n", len + maxi * (T - 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;
int a[100001];
int f[100001];
int s[301];
inline int find(int l, int r, int x) {
  while (l <= r) {
    int mid = (l + r) / 2;
    if (x >= f[mid])
      l = mid + 1;
    else
      r = mid - 1;
  }
  return r;
}
int main() {
  int n, T;
  scanf("%d%d", &n, &T);
  int i, j;
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (i = 1; i <= min(n, T); i++) {
    for (j = 1; j <= n; j++) a[i * n + j] = a[j];
  }
  int lim = n * min(n, T);
  int len = 1;
  f[1] = a[1];
  for (i = 2; i <= lim; i++) {
    int x = find(0, len, a[i]);
    if (x == len) len++;
    f[x + 1] = a[i];
  }
  if (T <= n)
    printf("%d\n", len);
  else {
    int maxx = 0, maxi = 0;
    for (i = 1; i <= n; i++) s[a[i]]++;
    for (i = 1; i <= 300; i++) maxi = max(s[i], maxi);
    printf("%d\n", len + maxi * (T - n));
  }
  return 0;
}

```