#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
const int SIZE = 1e6 + 10;
int d[301], dis[301][310], A[31][310][310], a[31][310];
template <class T>
void maa(T& x, T y) {
  if (x < y) x = y;
}
template <class T>
void mii(T& x, T y) {
  if (x > y) x = y;
}
int main() {
  int n, T;
  scanf("%d%d", &n, &T);
  for (int i = 0; i < (n); ++i) {
    scanf("%d", &(d[i]));
    d[i]--;
  }
  for (int i = 0; i < (n); ++i) {
    for (int j = 0; j < (d[i] + 1); ++j) {
      int ma = 0;
      for (int k = (j); k < (d[i] + 1); ++k) ma = max(ma, dis[j][k]);
      maa(dis[j][d[i]], ma + 1);
    }
  }
  for (int len = 1; len < 300; len++) {
    for (int i = 0; i + len < 300; i++) {
      maa(dis[i][i + len], dis[i][i + len - 1]);
      maa(dis[i][i + len], dis[i + 1][i + len]);
    }
  }
  for (int i = 0; i < (300); ++i)
    for (int j = 0; j < (300); ++j) A[0][i][j] = dis[i][j];
  int now = 0;
  while (T) {
    if (T & 1) {
      for (int i = 0; i < (300); ++i) {
        for (int j = (i); j < (300); ++j) {
          maa(a[now + 1][j], a[now][i] + A[now][i][j]);
        }
      }
    } else
      for (int i = 0; i < (300); ++i) a[now + 1][i] = a[now][i];
    for (int i = 0; i < (300); ++i)
      for (int j = (i); j < (300); ++j)
        for (int k = (j); k < (300); ++k) {
          maa(A[now + 1][i][k], A[now][i][j] + A[now][j][k]);
        }
    T >>= 1;
    now++;
  }
  int an = 0;
  for (int i = 0; i < (300); ++i) an = max(an, a[now][i]);
  cout << an;
  return 0;
}

### Prompt

Create a solution in CPP for 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;
const int MOD = 1e9 + 7;
const int SIZE = 1e6 + 10;
int d[301], dis[301][310], A[31][310][310], a[31][310];
template <class T>
void maa(T& x, T y) {
  if (x < y) x = y;
}
template <class T>
void mii(T& x, T y) {
  if (x > y) x = y;
}
int main() {
  int n, T;
  scanf("%d%d", &n, &T);
  for (int i = 0; i < (n); ++i) {
    scanf("%d", &(d[i]));
    d[i]--;
  }
  for (int i = 0; i < (n); ++i) {
    for (int j = 0; j < (d[i] + 1); ++j) {
      int ma = 0;
      for (int k = (j); k < (d[i] + 1); ++k) ma = max(ma, dis[j][k]);
      maa(dis[j][d[i]], ma + 1);
    }
  }
  for (int len = 1; len < 300; len++) {
    for (int i = 0; i + len < 300; i++) {
      maa(dis[i][i + len], dis[i][i + len - 1]);
      maa(dis[i][i + len], dis[i + 1][i + len]);
    }
  }
  for (int i = 0; i < (300); ++i)
    for (int j = 0; j < (300); ++j) A[0][i][j] = dis[i][j];
  int now = 0;
  while (T) {
    if (T & 1) {
      for (int i = 0; i < (300); ++i) {
        for (int j = (i); j < (300); ++j) {
          maa(a[now + 1][j], a[now][i] + A[now][i][j]);
        }
      }
    } else
      for (int i = 0; i < (300); ++i) a[now + 1][i] = a[now][i];
    for (int i = 0; i < (300); ++i)
      for (int j = (i); j < (300); ++j)
        for (int k = (j); k < (300); ++k) {
          maa(A[now + 1][i][k], A[now][i][j] + A[now][j][k]);
        }
    T >>= 1;
    now++;
  }
  int an = 0;
  for (int i = 0; i < (300); ++i) an = max(an, a[now][i]);
  cout << an;
  return 0;
}

```