#include <bits/stdc++.h>
using namespace std;
long long n, T, a[300000], i, j;
long long dp[300000], ans, l, r, mid, tem;
long f[400];
int main() {
  scanf("%I64d%I64d", &n, &T);
  for (i = 1; i <= n; ++i) {
    scanf("%I64d", &a[i]);
  }
  if (T <= 600) {
    for (i = 1; i < T; ++i) {
      for (j = 1; j <= n; ++j) {
        a[n * i + j] = a[j];
      }
    }
    n *= T;
    memset(dp, 0x3f, sizeof(dp));
    for (i = 1; i <= n; ++i) {
      l = 1;
      r = n + 5;
      while (l < r) {
        mid = (l + r) >> 1;
        if (dp[mid] > a[i])
          r = mid;
        else
          l = mid + 1;
      }
      dp[l] = a[i];
      ans = max(ans, l);
    }
    printf("%I64d\n", ans);
  } else {
    for (i = 1; i < 300; ++i) {
      for (j = 1; j <= n; ++j) {
        a[n * i + j] = a[j];
      }
    }
    n *= 300;
    memset(dp, 0x3f, sizeof(dp));
    for (i = 1; i <= n; ++i) {
      l = 1;
      r = n + 5;
      while (l < r) {
        mid = (l + r) >> 1;
        if (dp[mid] > a[i])
          r = mid;
        else
          l = mid + 1;
      }
      dp[l] = a[i];
      ans = max(ans, l);
    }
    n /= 300;
    tem = ans;
    for (i = 1; i <= n; ++i) {
      f[a[i]]++;
    }
    for (i = 1; i <= 300; ++i) {
      f[0] = max(f[0], f[i]);
    }
    tem = ans + (f[0]) * (T - 300);
    printf("%I64d\n", tem);
  }
  return 0;
}

### 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;
long long n, T, a[300000], i, j;
long long dp[300000], ans, l, r, mid, tem;
long f[400];
int main() {
  scanf("%I64d%I64d", &n, &T);
  for (i = 1; i <= n; ++i) {
    scanf("%I64d", &a[i]);
  }
  if (T <= 600) {
    for (i = 1; i < T; ++i) {
      for (j = 1; j <= n; ++j) {
        a[n * i + j] = a[j];
      }
    }
    n *= T;
    memset(dp, 0x3f, sizeof(dp));
    for (i = 1; i <= n; ++i) {
      l = 1;
      r = n + 5;
      while (l < r) {
        mid = (l + r) >> 1;
        if (dp[mid] > a[i])
          r = mid;
        else
          l = mid + 1;
      }
      dp[l] = a[i];
      ans = max(ans, l);
    }
    printf("%I64d\n", ans);
  } else {
    for (i = 1; i < 300; ++i) {
      for (j = 1; j <= n; ++j) {
        a[n * i + j] = a[j];
      }
    }
    n *= 300;
    memset(dp, 0x3f, sizeof(dp));
    for (i = 1; i <= n; ++i) {
      l = 1;
      r = n + 5;
      while (l < r) {
        mid = (l + r) >> 1;
        if (dp[mid] > a[i])
          r = mid;
        else
          l = mid + 1;
      }
      dp[l] = a[i];
      ans = max(ans, l);
    }
    n /= 300;
    tem = ans;
    for (i = 1; i <= n; ++i) {
      f[a[i]]++;
    }
    for (i = 1; i <= 300; ++i) {
      f[0] = max(f[0], f[i]);
    }
    tem = ans + (f[0]) * (T - 300);
    printf("%I64d\n", tem);
  }
  return 0;
}

```