#include <bits/stdc++.h>
using namespace std;
int dp[11111];
int a[11111];
int l[333], q[111];
int b[111];
int main() {
  int n, t, i, ans = 0, j, k, kl = 0;
  cin >> n >> t;
  for (i = 0; i < n; i++) {
    cin >> a[i];
    l[a[i]]++;
    q[i] = l[a[i]];
  }
  for (i = n; i < n * min(n, t); i++) a[i] = a[i % n];
  dp[0] = 1;
  for (i = 1; i < n * min(n, t); i++) {
    dp[i] = 1;
    for (j = i - 1; j >= 0; j--)
      if (a[j] <= a[i]) dp[i] = max(dp[i], dp[j] + 1);
  }
  for (i = 1; i < n * min(n, t); i++) dp[i] = max(dp[i], dp[i - 1]);
  for (i = n * (min(n, t) - 1); i < n * min(n, t); i++)
    ans = max(ans, dp[i] + ((bool)(t > n)) * l[a[i]] * (t - n) +
                       (dp[n * min(n, t) - 1] - dp[i]));
  cout << ans;
  return 0;
}
