#include <bits/stdc++.h>
using namespace std;
const int N = 100005;
const int INF = 0x3f3f3f3f;
int a[N];
int b[N];
int dd[N], mx;
int LIS(int ln) {
  int len = 1;
  dd[1] = a[0];
  for (int i = 1; i < ln; i++) {
    if (dd[len] <= a[i])
      dd[++len] = a[i];
    else
      *upper_bound(dd + 1, dd + len + 1, a[i]) = a[i];
  }
  return len;
}
int main() {
  int n, T, ans;
  scanf("%d%d", &n, &T);
  map<int, int> cnt;
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    cnt[a[i]]++;
    b[i] = a[i];
  }
  if (T <= 600) {
    for (int i = n; i < n * T; i++) {
      a[i] = a[i - n];
    }
    ans = LIS(n * T);
  } else {
    mx = -1;
    for (int i = 0; i < n; i++) {
      if (cnt[mx] < cnt[a[i]]) {
        mx = a[i];
      }
    }
    ans = (T - 600) * cnt[mx];
    for (int i = 0; i < n * 300; i++) {
      a[i] = b[i % n];
    }
    ans += LIS(300 * n) + cnt[mx] * 300;
  }
  printf("%d\n", ans);
  return 0;
}
