#include <bits/stdc++.h>
using namespace std;
bool chmax(int &a, int b) {
  if (a < b) {
    a = b;
    return true;
  } else
    return false;
}
int n, T;
int a[110];
int LIS(int Min, int Max) {
  int res = 1;
  int dp[110];
  for (int i = 0; i < 110; ++i) dp[i] = 1 << 29;
  for (int i = 0; i < n; ++i) {
    if (a[i] < Min || a[i] > Max) continue;
    int it = upper_bound(dp, dp + n, a[i]) - dp;
    dp[it] = a[i];
    chmax(res, it + 1);
  }
  return res;
}
int unit(int m, int res[][110], int a[][110], int b[][110]) {
  for (int i = 0; i < m; ++i) {
    for (int j = 0; j < m; ++j) {
      for (int k = 0; k < m; ++k) {
        chmax(res[i][j], res[i][k] + res[k][j]);
      }
    }
  }
}
int res[30][110][110];
int dp[30][110][110];
int solve() {
  map<int, int> ma;
  for (int i = 0; i < n; ++i) ma[a[i]]++;
  int m = 0;
  for (map<int, int>::iterator it = ma.begin(); it != ma.end(); ++it) {
    it->second = m++;
  }
  for (int i = 0; i < n; ++i) a[i] = ma[a[i]];
  memset(dp, -1, sizeof(dp));
  memset(res, 0, sizeof(res));
  for (int i = 0; i < m; ++i) {
    for (int j = i; j < m; ++j) {
      dp[0][i][j] = LIS(i, j);
    }
  }
  int LOG = 29;
  for (int i = 0; i < 29; ++i) {
    for (int p = 0; p < m; ++p) {
      for (int q = p; q < m; ++q) {
        for (int r = p; r <= q; ++r) {
          chmax(dp[i + 1][p][q], dp[i][p][r] + dp[i][r][q]);
          if (T & (1 << i)) {
            chmax(res[i + 1][p][q], res[i][p][r] + dp[i][r][q]);
          } else
            res[i + 1][p][q] = res[i][p][q];
        }
      }
    }
  }
  return res[LOG][0][m - 1];
}
int main() {
  while (cin >> n >> T) {
    for (int i = 0; i < n; ++i) cin >> a[i];
    cout << solve() << endl;
  }
}
