#include <bits/stdc++.h>
using namespace std;
const int N = 100;
int n, m;
int mas[N], a[N];
int fmas[111];
int di[26][100];
int mat[26][N][N];
int T, nT;
int fun(int mn, int mx) {
  memset(fmas, 0, sizeof fmas);
  fmas[0] = -1;
  int en = 0;
  for (int i = 0; i < n; ++i) {
    if (mas[i] < mn || mas[i] > mx) continue;
    int l = 0, r = en, mid, ans = 0;
    int t = mas[i];
    while (l <= r) {
      mid = (l + r) >> 1;
      if (t >= fmas[mid]) {
        ans = mid;
        l = mid + 1;
      } else {
        r = mid - 1;
      }
    }
    fmas[ans + 1] = t;
    if (ans == en) {
      en++;
    }
  }
  return en;
}
void solve() {
  cin >> n >> T;
  for (int i = 0; i < n; ++i) {
    cin >> mas[i];
    a[i] = mas[i];
  }
  sort(a, a + n);
  for (int i = 0; i < n; ++i) {
    for (int j = i; j < n; ++j) {
      mat[0][i][j] = fun(a[i], a[j]);
    }
  }
  for (int i = 1; (1 << i) <= T; ++i) {
    for (int j = 0; j < n; ++j) {
      for (int k = j; k < n; ++k) {
        for (int r = k; r < n; ++r) {
          mat[i][j][r] = max(mat[i][j][r], mat[i - 1][j][k] + mat[i - 1][k][r]);
        }
      }
    }
  }
  int cou = 0;
  for (int i = 25; i >= 0; --i) {
    if (T < (1 << i)) continue;
    T -= (1 << i);
    cou++;
    for (int j = 0; j < n; ++j) {
      for (int k = j; k < n; ++k) {
        di[cou][k] = max(di[cou][k], di[cou - 1][j] + mat[i][j][k]);
      }
    }
  }
  int ans = 0;
  for (int i = 0; i < n; ++i) ans = max(ans, di[cou][i]);
  cout << ans << endl;
}
int main() {
  solve();
  return 0;
}
