#include <bits/stdc++.h>
using namespace std;
const long long N = 1e6 + 2;
long long dp[N];
vector<long long> lis(long long *a, long long n, long long fac) {
  vector<long long> dp(n * fac + 1, 0);
  vector<long long> last(302, -1);
  for (long long i = 0; i < n * fac; ++i) {
    dp[i] = 1;
    long long val = a[i % n];
    for (long long j = 1; j <= val; ++j) {
      if (last[j] != -1) dp[i] = max(dp[i], 1 + dp[last[j]]);
    }
    last[val] = i;
  }
  return dp;
}
vector<long long> lis2(long long *a, long long n, long long fac) {
  vector<long long> dp(n * fac + 1, 0);
  vector<long long> last(302, -1);
  for (long long i = n * fac - 1; i >= 0; --i) {
    long long val = a[i % n];
    dp[i] = 1;
    for (long long j = val; j <= 300; ++j) {
      if (last[j] != -1) dp[i] = max(dp[i], 1 + dp[last[j]]);
    }
    last[val] = i;
  }
  return dp;
}
void solve() {
  long long n, t;
  cin >> n >> t;
  long long a[n];
  for (long long i = 0; i < n; ++i) cin >> a[i];
  if (t <= 3 * n) {
    auto vec = lis(a, n, t);
    long long mx = *max_element(vec.begin(), vec.end());
    cout << mx << '\n';
    return;
  }
  long long fre[302];
  memset(fre, 0, sizeof fre);
  for (long long i = 0; i < n; ++i) fre[a[i]]++;
  long long kitna = t - 2 * n;
  for (long long i = 1; i <= 300; ++i) fre[i] *= kitna;
  long long ans = 0;
  auto aav = lis(a, n, n);
  long long in[302];
  memset(in, 0, sizeof in);
  long long dec[302];
  memset(dec, 0, sizeof dec);
  for (long long i = 0; i < aav.size(); ++i) {
    long long val = a[i % n];
    in[val] = max(in[val], aav[i]);
  }
  auto ava = lis2(a, n, n);
  for (long long i = 0; i < ava.size(); ++i) {
    long long val = a[i % n];
    dec[val] = max(dec[val], ava[i]);
  }
  for (long long i = 1; i <= 300; ++i) {
    ans = max(ans, in[i] + fre[i] + dec[i]);
  }
  cout << ans << '\n';
}
signed main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  ;
  long long t = 1;
  while (t--) solve();
}
