#include <bits/stdc++.h>
using namespace std;
int l[110];
int tran[110];
long long dp[110][110];
long long mp[110][110];
long long bp[110][110];
long long tp[110][110];
bool cmp(int a, int b) { return l[a] < l[b]; }
int main() {
  int n, t, m;
  int i, j, k;
  int u;
  long long v;
  long long ma;
  scanf("%d %d", &n, &t);
  for (i = 0; i < n; i++) {
    scanf("%d", &l[i]);
    tran[i] = i;
    for (j = 0; j < n; j++) {
      dp[i][j] = 0;
      bp[i][j] = 0;
      mp[i][j] = 0;
    }
    dp[i][i] = 1;
  }
  sort(tran, tran + n, cmp);
  j = -1;
  u = -1;
  for (i = 0; i < n; i++) {
    if (l[tran[i]] != u) {
      j += 1;
    }
    u = l[tran[i]];
    l[tran[i]] = j;
  }
  m = j + 1;
  for (i = 0; i < n; i++) {
    for (j = 0; j < i; j++) {
      if (l[i] >= l[j]) {
        for (k = 0; k <= j; k++) {
          if (l[j] >= l[k]) {
            dp[k][i] = max(dp[k][i], dp[k][j] + 1);
          }
        }
      }
    }
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j <= i; j++) {
      bp[l[j]][l[i]] = max(bp[l[j]][l[i]], dp[j][i]);
    }
  }
  ma = 0;
  while (t > 0) {
    if (t & 1) {
      for (i = 0; i < m; i++) {
        for (j = 0; j <= i; j++) {
          tp[j][i] = 0;
          v = 0;
          for (k = j; k <= i; k++) {
            v = max(v, mp[j][k]);
            tp[j][i] = max(tp[j][i], v + bp[k][i]);
          }
        }
      }
      for (i = 0; i < m; i++) {
        for (j = 0; j <= i; j++) {
          mp[j][i] = tp[j][i];
          ma = max(ma, mp[j][i]);
        }
      }
    }
    for (i = 0; i < m; i++) {
      for (j = 0; j <= i; j++) {
        tp[j][i] = 0;
        v = 0;
        for (k = j; k <= i; k++) {
          v = max(v, bp[j][k]);
          tp[j][i] = max(tp[j][i], v + bp[k][i]);
        }
      }
    }
    for (i = 0; i < m; i++) {
      for (j = 0; j <= i; j++) {
        bp[j][i] = tp[j][i];
      }
    }
    t = t >> 1;
  }
  printf("%I64d\n", ma);
  return 0;
}

### Prompt

In Cpp, your task is to solve 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 l[110];
int tran[110];
long long dp[110][110];
long long mp[110][110];
long long bp[110][110];
long long tp[110][110];
bool cmp(int a, int b) { return l[a] < l[b]; }
int main() {
  int n, t, m;
  int i, j, k;
  int u;
  long long v;
  long long ma;
  scanf("%d %d", &n, &t);
  for (i = 0; i < n; i++) {
    scanf("%d", &l[i]);
    tran[i] = i;
    for (j = 0; j < n; j++) {
      dp[i][j] = 0;
      bp[i][j] = 0;
      mp[i][j] = 0;
    }
    dp[i][i] = 1;
  }
  sort(tran, tran + n, cmp);
  j = -1;
  u = -1;
  for (i = 0; i < n; i++) {
    if (l[tran[i]] != u) {
      j += 1;
    }
    u = l[tran[i]];
    l[tran[i]] = j;
  }
  m = j + 1;
  for (i = 0; i < n; i++) {
    for (j = 0; j < i; j++) {
      if (l[i] >= l[j]) {
        for (k = 0; k <= j; k++) {
          if (l[j] >= l[k]) {
            dp[k][i] = max(dp[k][i], dp[k][j] + 1);
          }
        }
      }
    }
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j <= i; j++) {
      bp[l[j]][l[i]] = max(bp[l[j]][l[i]], dp[j][i]);
    }
  }
  ma = 0;
  while (t > 0) {
    if (t & 1) {
      for (i = 0; i < m; i++) {
        for (j = 0; j <= i; j++) {
          tp[j][i] = 0;
          v = 0;
          for (k = j; k <= i; k++) {
            v = max(v, mp[j][k]);
            tp[j][i] = max(tp[j][i], v + bp[k][i]);
          }
        }
      }
      for (i = 0; i < m; i++) {
        for (j = 0; j <= i; j++) {
          mp[j][i] = tp[j][i];
          ma = max(ma, mp[j][i]);
        }
      }
    }
    for (i = 0; i < m; i++) {
      for (j = 0; j <= i; j++) {
        tp[j][i] = 0;
        v = 0;
        for (k = j; k <= i; k++) {
          v = max(v, bp[j][k]);
          tp[j][i] = max(tp[j][i], v + bp[k][i]);
        }
      }
    }
    for (i = 0; i < m; i++) {
      for (j = 0; j <= i; j++) {
        bp[j][i] = tp[j][i];
      }
    }
    t = t >> 1;
  }
  printf("%I64d\n", ma);
  return 0;
}

```