#include <bits/stdc++.h>
inline long long sbt(long long x) { return __builtin_popcount(x); }
using namespace std;
template <typename Arg1>
void __f(const char* name, Arg1&& arg1) {
  cout << name << " : " << arg1 << std::endl;
}
template <typename Arg1, typename... Args>
void __f(const char* names, Arg1&& arg1, Args&&... args) {
  const char* comma = strchr(names + 1, ',');
  cout.write(names, comma - names) << " : " << arg1 << " | ";
  __f(comma + 1, args...);
}
map<long long, long long> freq;
int32_t main() {
  cin.sync_with_stdio(false);
  cout.sync_with_stdio(false);
  long long n, t;
  cin >> n >> t;
  long long dp[n * n + 13], a[n + 13], maxi = 1;
  for (long long i = 1; i <= n; i++) {
    cin >> a[i];
    freq[a[i]]++;
    maxi = max(maxi, freq[a[i]]);
  }
  memset(dp, 0, sizeof dp);
  vector<long long> v;
  for (long long i = 1; i <= min(n, t); i++) {
    for (long long j = 1; j <= n; j++) {
      v.push_back(a[j]);
    }
  }
  for (long long i = 0; i < v.size(); i++) {
    dp[i] = 1;
    for (long long j = 0; j < i; j++) {
      if (v[i] >= v[j]) {
        dp[i] = max(dp[i], dp[j] + 1);
      }
    }
  }
  long long lis = *max_element(dp, dp + v.size());
  if ((n * t) > (n * n)) {
    cout << lis + (t - n) * maxi;
  } else {
    cout << lis;
  }
  return 0;
}
