#include <bits/stdc++.h>
using namespace std;
int a[10005], dp[10005], cnt[305];
int main() {
  int n, t;
  cin >> n >> t;
  for (int i = 1; i <= n; i++) {
    cin >> a[i];
    cnt[a[i]]++;
  }
  for (int i = n + 1; i <= min(n, t) * n; i++) a[i] = a[i - n];
  int ans = 0;
  for (int i = 1; i <= min(n, t) * n; i++) {
    dp[i] = 1;
    for (int j = 1; j < i; j++)
      if (a[i] >= a[j]) dp[i] = max(dp[i], dp[j] + 1);
    ans = max(ans, dp[i]);
  }
  int maxx = 0;
  for (int i = 1; i <= 300; i++) maxx = max(maxx, cnt[i]);
  cout << ans + maxx * max(t - n, 0) << endl;
  return 0;
}
