#include <bits/stdc++.h>
using namespace std;
void _read();
int n, t;
vector<int> v;
int get_lis(const vector<int> &b) {
  vector<int> dp;
  for (const int &x : b) {
    auto it = upper_bound((dp).begin(), (dp).end(), x);
    if (it == dp.end())
      dp.push_back(x);
    else
      *it = x;
  }
  return ((int)(dp).size());
}
void base() {
  if (n == 1) {
    cout << t << '\n';
    exit(0);
  }
  if (t <= 2 * n) {
    vector<int> b = {};
    for (int i = 0; i < t; i++) {
      b.insert(b.end(), (v).begin(), (v).end());
    }
    cout << get_lis(b) << '\n';
    exit(0);
  }
}
int main() {
  _read();
  cin >> n >> t;
  v = vector<int>(n);
  vector<int> b;
  int cnt[301] = {0};
  for (int &x : v) {
    cin >> x;
    cnt[x]++;
  }
  base();
  int mx = 0;
  for (int &x : v) mx = max(mx, cnt[x]);
  for (int i = 0; i < 2 * n; i++) {
    b.insert(b.end(), (v).begin(), (v).end());
  }
  int x = get_lis(b);
  cout << (t - 2 * n) * mx + x << '\n';
  return 0;
};
void _read() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
}

### Prompt

Create a solution in CPP for 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;
void _read();
int n, t;
vector<int> v;
int get_lis(const vector<int> &b) {
  vector<int> dp;
  for (const int &x : b) {
    auto it = upper_bound((dp).begin(), (dp).end(), x);
    if (it == dp.end())
      dp.push_back(x);
    else
      *it = x;
  }
  return ((int)(dp).size());
}
void base() {
  if (n == 1) {
    cout << t << '\n';
    exit(0);
  }
  if (t <= 2 * n) {
    vector<int> b = {};
    for (int i = 0; i < t; i++) {
      b.insert(b.end(), (v).begin(), (v).end());
    }
    cout << get_lis(b) << '\n';
    exit(0);
  }
}
int main() {
  _read();
  cin >> n >> t;
  v = vector<int>(n);
  vector<int> b;
  int cnt[301] = {0};
  for (int &x : v) {
    cin >> x;
    cnt[x]++;
  }
  base();
  int mx = 0;
  for (int &x : v) mx = max(mx, cnt[x]);
  for (int i = 0; i < 2 * n; i++) {
    b.insert(b.end(), (v).begin(), (v).end());
  }
  int x = get_lis(b);
  cout << (t - 2 * n) * mx + x << '\n';
  return 0;
};
void _read() {
  ios_base ::sync_with_stdio(false);
  cin.tie(NULL);
}

```