#include <bits/stdc++.h>
using namespace std;
const double PI = acos(-1);
const int inf = 0x3f3f3f3f;
const double eps = 1e-12;
const int maxn = 1e6 + 5;
const int mod = 1e9 + 7;
int dir[4][2] = {0, 1, 1, 0, 0, -1, -1, 0};
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
long long inv(long long b) {
  if (b == 1) return 1;
  return (mod - mod / b) * inv(mod % b) % mod;
}
long long fpow(long long n, long long k) {
  long long r = 1;
  for (; k; k >>= 1) {
    if (k & 1) r = r * n % mod;
    n = n * n % mod;
  }
  return r;
}
long long Fpow(long long n, long long k) {
  long long r = 1;
  for (; k; k >>= 1) {
    if (k & 1) r = r * n;
    n = n * n;
  }
  return r;
}
long long upd(long long x, long long v) {
  x = x + v >= mod ? x + v - mod : x + v;
  return x;
}
int a[maxn], vis[maxn], dp[maxn];
int main() {
  int n, t, i, j, k;
  scanf("%d%d", &n, &t);
  int maxx2 = 0;
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    vis[a[i]]++;
    maxx2 = max(maxx2, vis[a[i]]);
  }
  int temp = min(n, t);
  temp = n;
  i = n;
  while (temp--) {
    for (j = 1; j <= n; j++) a[j + i] = a[j];
    i += n;
  }
  int len = 1;
  dp[1] = a[1];
  for (i = 2; i <= n * (min(n, t)); i++) {
    if (a[i] >= dp[len])
      dp[++len] = a[i];
    else {
      int t = upper_bound(dp + 1, dp + len + 1, a[i]) - dp;
      dp[t] = a[i];
    }
  }
  int maxx1 = 0;
  int ans = len + maxx2 * (t - min(n, t));
  printf("%d\n", ans);
}

### Prompt

Generate 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;
const double PI = acos(-1);
const int inf = 0x3f3f3f3f;
const double eps = 1e-12;
const int maxn = 1e6 + 5;
const int mod = 1e9 + 7;
int dir[4][2] = {0, 1, 1, 0, 0, -1, -1, 0};
long long gcd(long long a, long long b) { return b ? gcd(b, a % b) : a; }
long long lcm(long long a, long long b) { return a / gcd(a, b) * b; }
long long inv(long long b) {
  if (b == 1) return 1;
  return (mod - mod / b) * inv(mod % b) % mod;
}
long long fpow(long long n, long long k) {
  long long r = 1;
  for (; k; k >>= 1) {
    if (k & 1) r = r * n % mod;
    n = n * n % mod;
  }
  return r;
}
long long Fpow(long long n, long long k) {
  long long r = 1;
  for (; k; k >>= 1) {
    if (k & 1) r = r * n;
    n = n * n;
  }
  return r;
}
long long upd(long long x, long long v) {
  x = x + v >= mod ? x + v - mod : x + v;
  return x;
}
int a[maxn], vis[maxn], dp[maxn];
int main() {
  int n, t, i, j, k;
  scanf("%d%d", &n, &t);
  int maxx2 = 0;
  for (i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    vis[a[i]]++;
    maxx2 = max(maxx2, vis[a[i]]);
  }
  int temp = min(n, t);
  temp = n;
  i = n;
  while (temp--) {
    for (j = 1; j <= n; j++) a[j + i] = a[j];
    i += n;
  }
  int len = 1;
  dp[1] = a[1];
  for (i = 2; i <= n * (min(n, t)); i++) {
    if (a[i] >= dp[len])
      dp[++len] = a[i];
    else {
      int t = upper_bound(dp + 1, dp + len + 1, a[i]) - dp;
      dp[t] = a[i];
    }
  }
  int maxx1 = 0;
  int ans = len + maxx2 * (t - min(n, t));
  printf("%d\n", ans);
}

```