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 tot, i, j, k, n, m, a[210001], f[210001], c[210001], w, b[1001], ans,
    g[210001];
int bs1(int x) {
  int l = 1, r = tot, m;
  if (x < c[1]) return 0;
  while (l < r - 1) {
    m = (l + r) >> 1;
    if (x >= c[m])
      l = m;
    else
      r = m - 1;
  }
  return (x >= c[r]) ? r : l;
}
int bs2(int x) {
  int l = 1, r = tot, m;
  if (x > c[1]) return 0;
  while (l < r - 1) {
    m = (l + r) >> 1;
    if (x <= c[m])
      l = m;
    else
      r = m - 1;
  }
  return (x <= c[r]) ? r : l;
}
int bfsolve() {
  for (i = 2; i <= m; i++)
    for (j = 1; j <= n; j++) a[n * (i - 1) + j] = a[j];
  for (tot = c[0] = 0, i = 1; i <= n * m; i++) {
    if (c[tot] <= a[i]) {
      c[++tot] = a[i];
      f[i] = tot;
      continue;
    }
    k = bs1(a[i]);
    f[i] = k + 1;
    c[k + 1] = min(c[k + 1], a[i]);
  }
  return tot;
}
int main() {
  scanf("%d%d", &n, &m);
  w = n + 1;
  memset(b, 0, sizeof(b));
  for (i = 1; i <= n; i++) scanf("%d", &a[i]), b[a[i]]++;
  if (m <= 2 * w) {
    printf("%d\n", bfsolve());
    return 0;
  }
  for (i = 2; i <= w; i++)
    for (j = 1; j <= n; j++) a[n * (i - 1) + j] = a[j];
  for (tot = c[0] = ans = 0, i = 1; i <= n * w; i++) {
    if (c[tot] <= a[i]) {
      c[++tot] = a[i];
      f[i] = tot;
      continue;
    }
    k = bs1(a[i]);
    f[i] = k + 1;
    c[k + 1] = min(c[k + 1], a[i]);
  }
  for (tot = c[0] = 0, i = n * w; i; i--) {
    if (!tot || c[tot] >= a[i]) {
      c[++tot] = a[i];
      g[i] = tot;
      continue;
    }
    k = bs2(a[i]);
    g[i] = k + 1;
    c[k + 1] = max(c[k + 1], a[i]);
  }
  for (i = n * (w - 1) + 1; i <= n * w; i++)
    for (j = 1; j <= n; j++) {
      if (a[i] > a[j]) continue;
      ans = max(ans, f[i] + g[j] + (m - 2 * w) * b[a[i]]);
    }
  printf("%d\n", ans);
  return 0;
}
