#include <bits/stdc++.h>
using namespace std;
long long bigmod(long long b, long long p) {
  if (p == 0) return 1;
  long long my = bigmod(b, p / 2);
  my *= my;
  my %= 1000000007;
  if (p & 1) my *= b, my %= 1000000007;
  return my;
}
int setb(int n, int pos) { return n = n | (1 << pos); }
int resb(int n, int pos) { return n = n & ~(1 << pos); }
bool checkb(int n, int pos) { return (bool)(n & (1 << pos)); }
long long ara[100000], L[100000], n, bra[100000], N, cnt[100000];
long long LIS() {
  long long i, j;
  for (i = 1; i <= N; i++) {
    L[i] = 1;
  }
  for (i = 2; i <= N; i++) {
    for (j = 1; j < i; j++) {
      if (ara[i] >= ara[j] && L[i] <= L[j]) {
        L[i] = L[j] + 1;
      }
    }
  }
  long long mx = 0;
  for (i = 1; i <= N; i++) {
    if (L[i] > mx) {
      mx = L[i];
    }
  }
  return mx;
}
int main() {
  long long i, j, t;
  scanf("%lld %lld", &n, &t);
  for (i = 1; i <= n; i++) {
    scanf("%lld", &bra[i]);
    cnt[bra[i]]++;
  }
  long long d = min(n, t);
  N = n * d;
  for (j = 0; j < d; j++) {
    for (i = 1; i <= n; i++) {
      ara[j * n + i] = bra[i];
    }
  }
  long long my = LIS();
  if (t > d) {
    long long mx = 0;
    for (i = 1; i <= n; i++) {
      if (cnt[bra[i]] > mx) mx = cnt[bra[i]];
    }
    my += (t - d) * mx;
  }
  printf("%lld", my);
  printf("\n");
  return 0;
}

### 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;
long long bigmod(long long b, long long p) {
  if (p == 0) return 1;
  long long my = bigmod(b, p / 2);
  my *= my;
  my %= 1000000007;
  if (p & 1) my *= b, my %= 1000000007;
  return my;
}
int setb(int n, int pos) { return n = n | (1 << pos); }
int resb(int n, int pos) { return n = n & ~(1 << pos); }
bool checkb(int n, int pos) { return (bool)(n & (1 << pos)); }
long long ara[100000], L[100000], n, bra[100000], N, cnt[100000];
long long LIS() {
  long long i, j;
  for (i = 1; i <= N; i++) {
    L[i] = 1;
  }
  for (i = 2; i <= N; i++) {
    for (j = 1; j < i; j++) {
      if (ara[i] >= ara[j] && L[i] <= L[j]) {
        L[i] = L[j] + 1;
      }
    }
  }
  long long mx = 0;
  for (i = 1; i <= N; i++) {
    if (L[i] > mx) {
      mx = L[i];
    }
  }
  return mx;
}
int main() {
  long long i, j, t;
  scanf("%lld %lld", &n, &t);
  for (i = 1; i <= n; i++) {
    scanf("%lld", &bra[i]);
    cnt[bra[i]]++;
  }
  long long d = min(n, t);
  N = n * d;
  for (j = 0; j < d; j++) {
    for (i = 1; i <= n; i++) {
      ara[j * n + i] = bra[i];
    }
  }
  long long my = LIS();
  if (t > d) {
    long long mx = 0;
    for (i = 1; i <= n; i++) {
      if (cnt[bra[i]] > mx) mx = cnt[bra[i]];
    }
    my += (t - d) * mx;
  }
  printf("%lld", my);
  printf("\n");
  return 0;
}

```