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;
const int N = 110;
const int M = 310;
int fp[M], fs[M];
int n, t;
int a[N], num[M];
int mx[M << 2];
void build(int l, int r, int k) {
  mx[k] = 0;
  if (l == r) return;
  int m = (l + r) >> 1;
  build(l, m, k << 1);
  build(m + 1, r, k << 1 | 1);
}
void update(int pos, int val, int l, int r, int k) {
  if (pos == l && l == r) {
    mx[k] = max(mx[k], val);
    return;
  }
  int m = (l + r) >> 1;
  if (pos <= m) update(pos, val, l, m, k << 1);
  if (pos > m) update(pos, val, m + 1, r, k << 1 | 1);
  mx[k] = max(mx[k << 1], mx[k << 1 | 1]);
}
int query1(int pos, int l, int r, int k) {
  if (r <= pos) {
    return mx[k];
  }
  int m = (l + r) >> 1;
  int res = 0;
  if (pos <= m) res = max(res, query1(pos, l, m, k << 1));
  if (pos > m) res = max(mx[k << 1], query1(pos, m + 1, r, k << 1 | 1));
  return res;
}
int query2(int pos, int l, int r, int k) {
  if (pos <= l) {
    return mx[k];
  }
  int m = (l + r) >> 1;
  int res = 0;
  if (pos > m) res = max(res, query2(pos, m + 1, r, k << 1 | 1));
  if (pos <= m) res = max(mx[k << 1 | 1], query2(pos, l, m, k << 1));
  return res;
}
int main() {
  scanf("%d%d", &n, &t);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  if (t <= 2 * n) {
    for (int i = 1; i <= n * t; i++) {
      int now = (i % n == 0 ? a[n] : a[i % n]);
      fp[now] = max(fp[now], query1(now, 1, 300, 1) + 1);
      update(now, fp[now], 1, 300, 1);
    }
    int ans = 0;
    for (int i = 1; i <= 300; i++) ans = max(ans, fp[i]);
    printf("%d\n", ans);
    return 0;
  }
  for (int i = 1; i <= n * n; i++) {
    int now = (i % n == 0 ? a[n] : a[i % n]);
    fp[now] = max(fp[now], query1(now, 1, 300, 1) + 1);
    update(now, fp[now], 1, 300, 1);
  }
  build(1, 300, 1);
  for (int i = n * n; i >= 1; i--) {
    int now = (i % n == 0 ? a[n] : a[i % n]);
    fs[now] = max(fs[now], query2(now, 1, 300, 1) + 1);
    update(now, fs[now], 1, 300, 1);
  }
  for (int i = 1; i <= n; i++) num[a[i]]++;
  int ans = 0;
  for (int i = 1; i <= 300; i++)
    for (int j = i; j <= 300; j++) {
      ans = max(ans, fs[j] + fp[i] + num[i] * (t - n * 2));
      ans = max(ans, fs[j] + fp[i] + num[j] * (t - n * 2));
    }
  printf("%d\n", ans);
}
