#include <bits/stdc++.h>
using namespace std;
int n, t, ja;
int v[105];
int u[105];
int l[105];
int dp[305];
int ans;
int main() {
  scanf("%d %d", &n, &t);
  memset(l, 0, sizeof l);
  memset(u, 0, sizeof u);
  memset(dp, 0, sizeof dp);
  ans = -1;
  for (int i = 0; i < n; i++) {
    scanf("%d", &v[i]);
    int maior = 1;
    int q = -1;
    for (int j = v[i]; j >= 0; j--) {
      if (maior <= dp[j]) {
        q = j;
        maior = dp[j];
      }
    }
    if (q < 0) {
      l[i] = maior;
      u[i] = v[i];
      dp[v[i]] = max(dp[v[i]], maior);
    } else {
      l[i] = maior + 1;
      u[i] = q;
      dp[v[i]] = max(dp[v[i]], maior + 1);
    }
    ans = max(ans, dp[v[i]]);
  }
  ja = 1;
  for (int j = 1; j < n && ja < t; j++) {
    for (int i = 0; i < n; i++) {
      int maior = 1;
      int q = -1;
      for (int j = v[i]; j >= 0; j--) {
        if (maior <= dp[j]) {
          q = j;
          maior = dp[j];
        }
      }
      if (q < 0) {
        l[i] = maior;
        u[i] = v[i];
        dp[v[i]] = max(dp[v[i]], maior);
      } else {
        l[i] = maior + 1;
        u[i] = q;
        dp[v[i]] = max(dp[v[i]], maior + 1);
      }
      ans = max(ans, dp[v[i]]);
    }
    ja++;
  }
  if (ja == t) {
    printf("%d\n", ans);
    return 0;
  }
  for (int i = 0; i < n; i++) {
    int maior = 1;
    int q = -1;
    for (int j = v[i]; j >= 0; j--) {
      if (maior <= dp[j]) {
        q = j;
        maior = dp[j];
      }
    }
    if (q < 0) {
      ans = max(ans, l[i] + (t - ja) * (maior - l[i]));
      l[i] = maior;
      u[i] = v[i];
      dp[v[i]] = max(dp[v[i]], maior);
    } else {
      ans = max(ans, l[i] + (t - ja) * (maior + 1 - l[i]));
      l[i] = maior + 1;
      u[i] = q;
      dp[v[i]] = max(dp[v[i]], maior + 1);
    }
    ans = max(ans, dp[v[i]]);
  }
  printf("%d\n", ans);
}

### Prompt

Please formulate 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 n, t, ja;
int v[105];
int u[105];
int l[105];
int dp[305];
int ans;
int main() {
  scanf("%d %d", &n, &t);
  memset(l, 0, sizeof l);
  memset(u, 0, sizeof u);
  memset(dp, 0, sizeof dp);
  ans = -1;
  for (int i = 0; i < n; i++) {
    scanf("%d", &v[i]);
    int maior = 1;
    int q = -1;
    for (int j = v[i]; j >= 0; j--) {
      if (maior <= dp[j]) {
        q = j;
        maior = dp[j];
      }
    }
    if (q < 0) {
      l[i] = maior;
      u[i] = v[i];
      dp[v[i]] = max(dp[v[i]], maior);
    } else {
      l[i] = maior + 1;
      u[i] = q;
      dp[v[i]] = max(dp[v[i]], maior + 1);
    }
    ans = max(ans, dp[v[i]]);
  }
  ja = 1;
  for (int j = 1; j < n && ja < t; j++) {
    for (int i = 0; i < n; i++) {
      int maior = 1;
      int q = -1;
      for (int j = v[i]; j >= 0; j--) {
        if (maior <= dp[j]) {
          q = j;
          maior = dp[j];
        }
      }
      if (q < 0) {
        l[i] = maior;
        u[i] = v[i];
        dp[v[i]] = max(dp[v[i]], maior);
      } else {
        l[i] = maior + 1;
        u[i] = q;
        dp[v[i]] = max(dp[v[i]], maior + 1);
      }
      ans = max(ans, dp[v[i]]);
    }
    ja++;
  }
  if (ja == t) {
    printf("%d\n", ans);
    return 0;
  }
  for (int i = 0; i < n; i++) {
    int maior = 1;
    int q = -1;
    for (int j = v[i]; j >= 0; j--) {
      if (maior <= dp[j]) {
        q = j;
        maior = dp[j];
      }
    }
    if (q < 0) {
      ans = max(ans, l[i] + (t - ja) * (maior - l[i]));
      l[i] = maior;
      u[i] = v[i];
      dp[v[i]] = max(dp[v[i]], maior);
    } else {
      ans = max(ans, l[i] + (t - ja) * (maior + 1 - l[i]));
      l[i] = maior + 1;
      u[i] = q;
      dp[v[i]] = max(dp[v[i]], maior + 1);
    }
    ans = max(ans, dp[v[i]]);
  }
  printf("%d\n", ans);
}

```