#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
const int maxn = 1000005, maxm = 105;
const double eps = 1e-9;
const double pi = acos(-1.0);
int n, T, a[maxn], b[maxn] = {0};
vector<int> v;
int dp[maxn];
int cal() {
  int nn = v.size(), i, j;
  for (i = 0; i <= nn; i++) {
    dp[i] = mod;
  }
  for (i = 0; i < nn; i++) {
    int tp = upper_bound(dp, dp + nn, v[i]) - dp;
    dp[tp] = v[i];
  }
  return upper_bound(dp, dp + nn, mod - 1) - dp;
}
int r = 0;
int main() {
  int i, j;
  scanf("%d %d", &n, &T);
  for (i = 0; i < n; i++) scanf("%d", a + i), ++b[a[i]];
  if (T <= 2 * maxm) {
    for (i = 0; i < n * T; i++) v.push_back(a[i % n]);
    printf("%d\n", cal());
    return 0;
  }
  for (i = 300; i > 0; i--) {
    if (!b[i]) continue;
    v.clear();
    for (j = 0; j < n * maxm; j++) {
      if (a[j % n] <= i) v.push_back(a[j % n]);
    }
    int rt = cal();
    v.clear();
    for (j = 0; j < n * maxm; j++) {
      if (a[j % n] >= i) v.push_back(a[j % n]);
    }
    rt += cal();
    r = max(r, rt + b[i] * (T - 2 * maxm));
  }
  printf("%d\n", r);
  return 0;
}
