#include <bits/stdc++.h>
using namespace std;
const int maxN = 100;
const int maxK = 300;
vector<int> V, V2, V3;
int izq[maxN + 1][maxK + 1];
int der[maxN + 1][maxK + 1];
multimap<int, int> T;
vector<int> rep(maxK + 1, 0);
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(NULL);
  int n, t, z, x, mayor, ans, i, j, l;
  cin >> n >> t;
  z = n * n;
  for (i = 0; i < n; i++) {
    cin >> x;
    rep[x]++;
    V.push_back(x);
  }
  for (i = 0; i < n; i++) {
    for (j = 0; j < n; j++) V2.push_back(V[j]);
    for (j = n - 1; j >= 0; j--) V3.push_back(V[j]);
  }
  vector<int> DP(z, 1), DP2(maxK + 1, 0);
  for (j = 0; j <= maxK; j++) {
    izq[0][j] = 0;
  }
  for (i = 0; i < z; i++) {
    for (j = 0; j <= V2[i]; j++) DP[i] = max(DP[i], DP2[j] + 1);
    DP2[V2[i]] = DP[i];
    if ((i + 1) % n == 0) {
      mayor = 0;
      for (j = 0; j <= maxK; j++) {
        mayor = max(mayor, DP2[j]);
        izq[(i + 1) / n][j] = mayor;
      }
    }
  }
  T.clear();
  DP.clear();
  DP.resize(z, 0);
  DP2.clear();
  DP2.resize(maxK + 1, 0);
  for (j = 0; j <= maxK; j++) {
    der[0][j] = 0;
  }
  for (i = 0; i < z; i++) {
    for (j = maxK; j >= V3[i]; j--) DP[i] = max(DP[i], DP2[j] + 1);
    DP2[V3[i]] = DP[i];
    if ((i + 1) % n == 0) {
      mayor = 0;
      for (j = maxK; j >= 0; j--) {
        mayor = max(mayor, DP2[j]);
        der[(i + 1) / n][j] = mayor;
      }
    }
  }
  ans = 0;
  for (i = 0; i <= maxK; i++) {
    for (j = 0; j <= n; j++) {
      for (l = 0; l <= n; l++) {
        x = t - (j + l);
        if (x >= 0) ans = max(ans, izq[j][i] + der[l][i] + x * rep[i]);
      }
    }
  }
  cout << ans << '\n';
}
