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>
const int N = 105;
const int LIM = 305;
int n, ti;
int a[N];
int b[N * LIM * 2];
int f[2][N * LIM * 2];
int lowbit(int x) { return x & (-x); }
struct Fenwick_Tree {
  int e[LIM];
  void clear() { std::fill(e + 1, e + 300 + 1, 0); }
  void add(int pos, int delta) {
    for (int i = pos; i <= 300; i += lowbit(i)) {
      e[i] = std::max(e[i], delta);
    }
  }
  int get_max(int pos) {
    int ret = 0;
    for (int i = pos; i >= 1; i -= lowbit(i)) {
      ret = std::max(ret, e[i]);
    }
    return ret;
  }
};
void init() {
  std::cin >> n >> ti;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
}
void get_f(int size) {
  static Fenwick_Tree ft;
  ft.clear();
  std::fill(f[0] + 1, f[0] + size + 1, 0);
  for (int i = 1; i <= size; i++) {
    f[0][i] = ft.get_max(b[i]) + 1;
    ft.add(b[i], f[0][i]);
  }
  ft.clear();
  std::fill(f[1] + 1, f[1] + size + 1, 0);
  for (int i = size; i >= 1; i--) {
    f[1][i] = ft.get_max(300 - b[i] + 1) + 1;
    ft.add(300 - b[i] + 1, f[1][i]);
  }
}
void work() {
  if (ti <= 600) {
    int tot = 0;
    for (int t = 1; t <= ti; t++) {
      for (int i = 1; i <= n; i++) {
        b[++tot] = a[i];
      }
    }
    get_f(ti * n);
    std::cout << *std::max_element(f[0] + 1, f[0] + ti * n + 1) << std::endl;
  } else {
    int tot = 0;
    for (int t = 1; t <= 300; t++) {
      for (int i = 1; i <= n; i++) {
        b[++tot] = a[i];
      }
    }
    get_f(300 * n);
    static int count[LIM], max[LIM][LIM];
    static int best[2][LIM];
    for (int i = 1; i <= n; i++) {
      count[a[i]]++;
    }
    for (int i = 1; i <= 300; i++) {
      for (int j = i; j <= 300; j++) {
        max[i][j] = 0;
        for (int k = i; k <= j; k++) {
          max[i][j] = std::max(max[i][j], count[k]);
        }
      }
    }
    memset(best, 0, sizeof(best));
    for (int i = 1; i <= 300 * n; i++) {
      best[0][b[i]] = std::max(best[0][b[i]], f[0][i]);
      best[1][b[i]] = std::max(best[1][b[i]], f[1][i]);
    }
    int ans = 0;
    for (int i = 1; i <= 300; i++) {
      for (int j = i; j <= 300; j++) {
        ans = std::max(ans, best[0][i] + max[i][j] * (ti - 600) + best[1][j]);
      }
    }
    std::cout << ans << std::endl;
  }
}
int main() {
  init();
  work();
  return 0;
}
