#include <bits/stdc++.h>
using namespace std;
int a[10005], cnt[305], dp[10005], inf = 1e8;
int main() {
  int n, t;
  scanf("%d %d", &n, &t);
  int max_num = 0, len = n * min(n, t);
  for (int i = 1; i <= n; ++i) {
    scanf("%d", a + i);
    max_num = max(max_num, ++cnt[a[i]]);
  }
  for (int i = n + 1; i <= len; ++i) {
    a[i] = a[i - n];
  }
  int ans = 0;
  for (int i = 1; i <= len; ++i) {
    dp[i] = 1;
    for (int j = i - 1; j >= max(i - n, 1); --j) {
      if (a[i] >= a[j]) {
        dp[i] = max(dp[i], dp[j] + 1);
      }
    }
    ans = max(ans, dp[i]);
  }
  if (t <= n) {
    printf("%d\n", ans);
  } else {
    printf("%d\n", ans + max_num * (t - n));
  }
  return 0;
}
