#include <bits/stdc++.h>
using namespace std;
int n, T;
int a[105];
int l[105][105];
int A[105], _A;
int res[105][105];
int tmp[105][105];
void solve() {
  memset(res, 0, sizeof(res));
  while (T) {
    if (T & 1) {
      for (int i = 1; i <= _A; i++)
        for (int j = 1; j <= _A; j++) tmp[i][j] = res[i][j];
      for (int i = 1; i <= _A; i++)
        for (int k = i; k <= _A; k++)
          for (int j = k; j <= _A; j++)
            res[i][j] = max(res[i][j], tmp[i][k] + l[k][j]);
    }
    T >>= 1;
    for (int i = 1; i <= _A; i++)
      for (int j = 1; j <= _A; j++) tmp[i][j] = 0;
    for (int i = 1; i <= _A; i++)
      for (int k = i; k <= _A; k++)
        for (int j = k; j <= _A; j++)
          tmp[i][j] = max(tmp[i][j], l[i][k] + l[k][j]);
    for (int i = 1; i <= _A; i++)
      for (int j = 1; j <= _A; j++) l[i][j] = tmp[i][j];
  }
}
int main() {
  scanf("%d%d", &n, &T);
  for (int i = 1; i <= n; i++) {
    scanf("%d", a + i);
    A[i] = a[i];
  }
  sort(A + 1, A + n + 1);
  _A = unique(A + 1, A + n + 1) - A - 1;
  for (int i = 1; i <= n; i++) {
    a[i] = lower_bound(A + 1, A + _A + 1, a[i]) - A;
  }
  memset(tmp, -1, sizeof(tmp));
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j++) {
      if (i == j) tmp[i][j] = 1;
      for (int k = i; k <= j - 1; k++) {
        if (a[j] >= a[k] && tmp[i][k] != -1) {
          tmp[i][j] = max(tmp[i][j], tmp[i][k] + 1);
        }
      }
    }
  }
  for (int i = 1; i <= n; i++)
    for (int j = i; j <= n; j++) l[a[i]][a[j]] = max(l[a[i]][a[j]], tmp[i][j]);
  for (int i = _A; i >= 1; i--) {
    for (int j = 1; j <= _A; j++) {
      l[i][j] = max(l[i][j], max(l[i + 1][j], l[i][j - 1]));
    }
  }
  solve();
  printf("%d\n", res[1][_A]);
  return 0;
}

### 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>
using namespace std;
int n, T;
int a[105];
int l[105][105];
int A[105], _A;
int res[105][105];
int tmp[105][105];
void solve() {
  memset(res, 0, sizeof(res));
  while (T) {
    if (T & 1) {
      for (int i = 1; i <= _A; i++)
        for (int j = 1; j <= _A; j++) tmp[i][j] = res[i][j];
      for (int i = 1; i <= _A; i++)
        for (int k = i; k <= _A; k++)
          for (int j = k; j <= _A; j++)
            res[i][j] = max(res[i][j], tmp[i][k] + l[k][j]);
    }
    T >>= 1;
    for (int i = 1; i <= _A; i++)
      for (int j = 1; j <= _A; j++) tmp[i][j] = 0;
    for (int i = 1; i <= _A; i++)
      for (int k = i; k <= _A; k++)
        for (int j = k; j <= _A; j++)
          tmp[i][j] = max(tmp[i][j], l[i][k] + l[k][j]);
    for (int i = 1; i <= _A; i++)
      for (int j = 1; j <= _A; j++) l[i][j] = tmp[i][j];
  }
}
int main() {
  scanf("%d%d", &n, &T);
  for (int i = 1; i <= n; i++) {
    scanf("%d", a + i);
    A[i] = a[i];
  }
  sort(A + 1, A + n + 1);
  _A = unique(A + 1, A + n + 1) - A - 1;
  for (int i = 1; i <= n; i++) {
    a[i] = lower_bound(A + 1, A + _A + 1, a[i]) - A;
  }
  memset(tmp, -1, sizeof(tmp));
  for (int i = 1; i <= n; i++) {
    for (int j = i; j <= n; j++) {
      if (i == j) tmp[i][j] = 1;
      for (int k = i; k <= j - 1; k++) {
        if (a[j] >= a[k] && tmp[i][k] != -1) {
          tmp[i][j] = max(tmp[i][j], tmp[i][k] + 1);
        }
      }
    }
  }
  for (int i = 1; i <= n; i++)
    for (int j = i; j <= n; j++) l[a[i]][a[j]] = max(l[a[i]][a[j]], tmp[i][j]);
  for (int i = _A; i >= 1; i--) {
    for (int j = 1; j <= _A; j++) {
      l[i][j] = max(l[i][j], max(l[i + 1][j], l[i][j - 1]));
    }
  }
  solve();
  printf("%d\n", res[1][_A]);
  return 0;
}

```