#include <bits/stdc++.h>
char _;
using namespace std;
int N, T, A[101], dp[10001], ct[301];
int main() {
  scanf("%d%d", &N, &T);
  int m = 0;
  for (int i = 0; i < N; ++i) {
    scanf("%d", &A[i]);
    ct[A[i]]++;
    m = max(m, ct[A[i]]);
  }
  int l = min(100, T);
  int ans = 0;
  for (int i = 0; i < l * N; ++i) {
    for (int j = max(i - N, 0); j < i; ++j)
      if (A[j % N] <= A[i % N]) dp[i] = max(dp[i], dp[j] + 1);
    dp[i] = max(dp[i], 1);
    ans = max(ans, dp[i]);
  }
  ans += (T - l) * m;
  printf("%d", ans);
  return 0;
}
