#include <bits/stdc++.h>
using namespace std;
const int MOD = 1000000007;
template <class T, class U>
inline T tmin(T a, U b) {
  return (a < b) ? a : b;
}
template <class T, class U>
inline T tmax(T a, U b) {
  return (a > b) ? a : b;
}
template <class T, class U>
inline void amax(T &a, U b) {
  if (b > a) a = b;
}
template <class T, class U>
inline void amin(T &a, U b) {
  if (b < a) a = b;
}
template <class T>
inline T tabs(T a) {
  return (a > 0) ? a : -a;
}
template <class T>
T gcd(T a, T b) {
  while (b != 0) {
    T c = a;
    a = b;
    b = c % b;
  }
  return a;
}
const int INF = 1e9;
int n, T, cnt[301];
int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  memset(cnt, 0, sizeof(cnt));
  cin >> n >> T;
  int m = min(T, 1000);
  vector<int> a(n * m);
  for (int i = (0); i < (n); ++i) {
    cin >> a[i];
    cnt[a[i]]++;
  }
  for (int i = (n); i < (m * n); ++i) a[i] = a[i % n];
  vector<int> dp(n * m + 5, INF);
  for (int i = (0); i < (m * n); ++i) {
    *upper_bound(dp.begin(), dp.end(), a[i]) = a[i];
  }
  int ret = lower_bound(dp.begin(), dp.end(), INF) - dp.begin();
  int maxi = 0;
  for (int i = (1); i < (301); ++i) amax(maxi, cnt[i]);
  ret += (T - m) * maxi;
  cout << ret << endl;
  return 0;
}

### Prompt

Develop a solution in cpp to the problem described below:

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 int MOD = 1000000007;
template <class T, class U>
inline T tmin(T a, U b) {
  return (a < b) ? a : b;
}
template <class T, class U>
inline T tmax(T a, U b) {
  return (a > b) ? a : b;
}
template <class T, class U>
inline void amax(T &a, U b) {
  if (b > a) a = b;
}
template <class T, class U>
inline void amin(T &a, U b) {
  if (b < a) a = b;
}
template <class T>
inline T tabs(T a) {
  return (a > 0) ? a : -a;
}
template <class T>
T gcd(T a, T b) {
  while (b != 0) {
    T c = a;
    a = b;
    b = c % b;
  }
  return a;
}
const int INF = 1e9;
int n, T, cnt[301];
int main(int argc, char *argv[]) {
  ios_base::sync_with_stdio(false);
  memset(cnt, 0, sizeof(cnt));
  cin >> n >> T;
  int m = min(T, 1000);
  vector<int> a(n * m);
  for (int i = (0); i < (n); ++i) {
    cin >> a[i];
    cnt[a[i]]++;
  }
  for (int i = (n); i < (m * n); ++i) a[i] = a[i % n];
  vector<int> dp(n * m + 5, INF);
  for (int i = (0); i < (m * n); ++i) {
    *upper_bound(dp.begin(), dp.end(), a[i]) = a[i];
  }
  int ret = lower_bound(dp.begin(), dp.end(), INF) - dp.begin();
  int maxi = 0;
  for (int i = (1); i < (301); ++i) amax(maxi, cnt[i]);
  ret += (T - m) * maxi;
  cout << ret << endl;
  return 0;
}

```