#include <bits/stdc++.h>
using namespace std;
const int Max = 1000000001;
int n, t, i, j, k, ans, a[201], f[201], p[101][101], A[101][101], c[101][101];
void mul(int a[101][101], int b[101][101]) {
  int i, j;
  for (i = 0; i < n; i++)
    for (j = 0; j < n; j++) c[i][j] = -Max;
  for (i = 0; i < n; i++)
    for (j = 0; j < n; j++)
      for (k = 0; k < n; k++) c[i][j] = max(c[i][j], a[i][k] + b[k][j] - 1);
  for (i = 0; i < n; i++)
    for (j = 0; j < n; j++) p[i][j] = c[i][j];
}
void solve(int x) {
  if (x <= 1) return;
  solve(x / 2);
  mul(p, p);
  if (x % 2 == 1) mul(p, A);
}
int main() {
  scanf("%d%d", &n, &t);
  for (i = 0; i < n; i++) scanf("%d", &a[i]);
  for (i = n; i < n * 2; i++) a[i] = a[i % n];
  for (i = 0; i < n; i++) {
    for (j = i; j < n * 2; j++) f[j] = -Max;
    for (j = i; j < n * 2; j++) {
      if (a[j] >= a[i]) {
        f[j] = 1;
        for (k = i; k < j; k++)
          if (a[j] >= a[k]) f[j] = max(f[j], f[k] + 1);
      }
      A[i][j % n] = f[j];
    }
  }
  if (t > 1) {
    for (i = 0; i < n; i++)
      for (j = 0; j < n; j++) p[i][j] = A[i][j];
    solve(t - 1);
    ans = 0;
    for (i = 0; i < n; i++)
      for (j = 0; j < n; j++) ans = max(ans, p[i][j]);
    cout << ans;
  } else {
    for (i = 0; i < n; i++) f[i] = 1;
    for (i = 0; i < n; i++)
      for (j = 0; j < i; j++)
        if (a[i] >= a[j]) f[i] = max(f[i], f[j] + 1);
    ans = 0;
    for (i = 0; i < n; i++) ans = max(ans, f[i]);
    cout << ans;
  }
  return 0;
}
