#include <bits/stdc++.h>
using namespace std;
const long long INF = 1 << 30;
const int N = 1e2;
int ar[1111111];
long long dp[1111111];
map<int, int> mpi;
int main() {
  int n, t, MAX = -1, cnt = 0;
  cin >> n >> t;
  int cnt2;
  int NUM_CNT = 300;
  if (t >= NUM_CNT) {
    cnt2 = NUM_CNT;
  } else
    cnt2 = t;
  t -= NUM_CNT;
  for (int i = 1; i <= N * NUM_CNT + 5; i++) {
    dp[i] = INF;
  }
  dp[0] = -INF;
  for (int i = 0; i < n; i++) {
    cin >> ar[i];
    mpi[ar[i]]++;
    MAX = max(MAX, mpi[ar[i]]);
  }
  for (int i = n; i < n * cnt2; i++) {
    ar[i] = ar[i - n];
  }
  for (int i = 0; i < n * cnt2; i++) {
    int j = int(upper_bound(dp, dp + cnt2 * n, ar[i]) - dp);
    if (dp[j - 1] <= ar[i] && ar[i] < dp[j]) {
      dp[j] = ar[i];
    }
  }
  long long ans = 0, temp = 0;
  for (int i = 1; i <= n * cnt2; i++) {
    if (dp[i] != INF) {
      temp = i;
    }
    ans = max(temp, ans);
  }
  if (t > 0) {
    ans += MAX * t;
  }
  cout << ans;
}
