#include <bits/stdc++.h>
using namespace std;
int n, m, a[110], b[310], c[10010], f[10010], q[10010], ans;
void work(int n) {
  for (int i = 1; i <= n; i++) q[i] = 1000000000;
  for (int i = 1; i <= n; i++) {
    int l = 0, r = n;
    while (l != r) {
      if (l + 1 == r)
        if (q[r] <= c[i]) {
          l = r;
          break;
        } else
          break;
      int mid = (l + r) / 2;
      if (q[mid] <= c[i])
        l = mid;
      else
        r = mid;
    }
    ans = max(ans, l + 1);
    q[l + 1] = min(q[l + 1], c[i]);
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  if (m <= n) {
    int zz = 0;
    for (int i = 1; i <= m; i++) {
      for (int j = 1; j <= n; j++) c[++zz] = a[j];
    }
    work(zz);
    printf("%d\n", ans);
  } else {
    int zz = 0;
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) c[++zz] = a[j];
    }
    work(zz);
    int lans = 0;
    for (int i = 1; i <= n; i++) {
      b[a[i]]++;
      lans = max(lans, b[a[i]]);
    }
    printf("%d\n", lans * (m - n) + ans);
  }
  return 0;
}

### Prompt

Construct a CPP code solution to the problem outlined:

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 n, m, a[110], b[310], c[10010], f[10010], q[10010], ans;
void work(int n) {
  for (int i = 1; i <= n; i++) q[i] = 1000000000;
  for (int i = 1; i <= n; i++) {
    int l = 0, r = n;
    while (l != r) {
      if (l + 1 == r)
        if (q[r] <= c[i]) {
          l = r;
          break;
        } else
          break;
      int mid = (l + r) / 2;
      if (q[mid] <= c[i])
        l = mid;
      else
        r = mid;
    }
    ans = max(ans, l + 1);
    q[l + 1] = min(q[l + 1], c[i]);
  }
}
int main() {
  scanf("%d%d", &n, &m);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  if (m <= n) {
    int zz = 0;
    for (int i = 1; i <= m; i++) {
      for (int j = 1; j <= n; j++) c[++zz] = a[j];
    }
    work(zz);
    printf("%d\n", ans);
  } else {
    int zz = 0;
    for (int i = 1; i <= n; i++) {
      for (int j = 1; j <= n; j++) c[++zz] = a[j];
    }
    work(zz);
    int lans = 0;
    for (int i = 1; i <= n; i++) {
      b[a[i]]++;
      lans = max(lans, b[a[i]]);
    }
    printf("%d\n", lans * (m - n) + ans);
  }
  return 0;
}

```