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. 
#include <bits/stdc++.h>
using namespace std;
int MAXV = 300;
vector<int> calc_best_len_for_value_left_to_right(const vector<int> &data) {
  int N = (int)data.size();
  vector<int> DP(data.size());
  for (int i = 0; i < N; i++) {
    int local_res = 0;
    for (int j = 0; j < i; j++) {
      if (data[j] <= data[i]) local_res = max(local_res, DP[j]);
    }
    DP[i] = local_res + 1;
  }
  vector<int> res(MAXV + 1, 0);
  for (int i = 0; i < N; i++) res[data[i]] = max(res[data[i]], DP[i]);
  return res;
}
vector<int> calc_best_len_for_value_right_to_left(const vector<int> &data) {
  int N = (int)data.size();
  vector<int> tmp = data;
  reverse(tmp.begin(), tmp.end());
  for (int i = 0; i < N; i++) tmp[i] = MAXV - tmp[i];
  vector<int> res = calc_best_len_for_value_left_to_right(tmp);
  reverse(res.begin(), res.end());
  return res;
}
vector<int> calc_num_of_use(const vector<int> &data) {
  int N = (int)data.size();
  vector<int> res(MAXV + 1, 0);
  for (int i = 0; i < N; i++) res[data[i]]++;
  return res;
}
template <class IT>
void apply_for_range(IT begin_in, IT end_in, IT begin_out, IT end_out) {
  size_t N = (end_in - begin_in);
  *(begin_out) = *(begin_in);
  for (size_t i = 1; i < N; i++) {
    *(begin_out + i) = max(*(begin_in + i - 1), *(begin_in + i));
  }
}
int main(int argc, char *argv[]) {
  int T, N;
  cin >> N >> T;
  vector<int> data(N);
  for (int i = 0; i < N; i++) cin >> data[i];
  if (T <= 2 * N) {
    vector<int> data_all = data;
    for (int k = 1; k < T; k++)
      data_all.insert(data_all.end(), data.begin(), data.end());
    vector<int> best_LforV_LR = calc_best_len_for_value_left_to_right(data_all);
    cout << *max_element(best_LforV_LR.begin(), best_LforV_LR.end());
  } else {
    vector<int> data_all = data;
    for (int k = 1; k < N; k++)
      data_all.insert(data_all.end(), data.begin(), data.end());
    vector<int> best_LforV_LR = calc_best_len_for_value_left_to_right(data_all);
    vector<int> best_Lfor_range_LR = best_LforV_LR;
    apply_for_range(best_LforV_LR.begin(), best_LforV_LR.end(),
                    best_Lfor_range_LR.begin(), best_Lfor_range_LR.end());
    vector<int> best_LforV_RL = calc_best_len_for_value_right_to_left(data_all);
    vector<int> best_Lfor_range_RL = best_LforV_RL;
    apply_for_range(best_LforV_RL.begin(), best_LforV_RL.end(),
                    best_Lfor_range_RL.begin(), best_Lfor_range_RL.end());
    vector<int> quantity_of_val = calc_num_of_use(data);
    int res = 0;
    for (int v = 1; v <= MAXV; v++)
      res = max(res, best_LforV_LR[v] + (T - 2 * N) * quantity_of_val[v] +
                         best_LforV_RL[v]);
    cout << res << endl;
  }
  return 0;
}
