#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e2 + 10, inf = 1e9;
struct mat {
  int n, m, mtx[maxn][maxn];
  mat(int _n, int _m, int val = -inf) {
    n = _n, m = _m;
    for (int i = 0; i < n; ++i)
      for (int j = 0; j < m; ++j) mtx[i][j] = val;
  }
  int* operator[](int x) { return mtx[x]; }
  mat operator*(mat x) {
    mat ans(n, x.m);
    for (int i = 0; i < ans.n; ++i)
      for (int j = 0; j < ans.m; ++j)
        for (int k = 0; k < m; ++k)
          ans[i][j] = max(ans[i][j], mtx[i][k] + x[k][j]);
    return ans;
  }
  void operator*=(mat x) { *this = *this * x; };
  mat operator^(int power) {
    mat ans = *this, a = *this;
    power--;
    for (; power; power >>= 1, a *= a)
      if (power & 1) ans *= a;
    return ans;
  }
  void operator^=(int power) { *this = *this ^ power; }
};
int n, t, dp[maxn << 1][maxn << 1], a[maxn << 1], ans;
int main() {
  cin >> n >> t;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    a[i + n] = a[i];
    dp[i][i] = 1, dp[i + n][i + n] = 1;
  }
  for (int i = 1; i < (n << 1); ++i)
    for (int j = 0; j < (n << 1) - i; ++j)
      if (a[j] <= a[i + j]) {
        dp[j][i + j] = 2;
        for (int k = j + 1; k < i + j; ++k)
          dp[j][i + j] = max(dp[j][i + j], dp[j][k] + dp[k][i + j] - 1);
      } else
        dp[j][i + j] = -inf;
  mat base_m(1, n), main_m(n, n);
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) main_m[j][i] = dp[j][i + n] - 1;
    for (int j = 0; j <= i; ++j) base_m[0][i] = max(base_m[0][i], dp[j][i]);
  }
  if (t - 1) base_m *= main_m ^ (t - 1);
  for (int i = 0; i < n; ++i) ans = max(ans, base_m[0][i]);
  cout << ans << '\n';
  return 0;
}
