#include <bits/stdc++.h>
using namespace std;
int num[1111];
int dp[1111111];
int a[1111111];
int find(int l, int r, int x) {
  int res = 1;
  for (int i = l; i <= r; ++i) {
    if (a[i] <= x) {
      res = max(res, dp[i] + 1);
    }
  }
  return res;
}
void solve() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, T;
  cin >> n >> T;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    num[a[i]]++;
  }
  if (T <= 600) {
    int res = 0;
    for (int i = 0; i < n * T; ++i) {
      a[i] = a[i % n];
      dp[i] = find(max(0, i - n), i - 1, a[i]);
      res = max(res, dp[i]);
    }
    cout << res << endl;
    return;
  }
  int rep = 200;
  for (int i = 0; i < n * rep; ++i) {
    a[i] = a[i % n];
    dp[i] = find(max(0, i - n), i - 1, a[i]);
  }
  for (int i = n * (rep - 1); i < n * rep; ++i) {
    dp[i - n * (rep - 1)] = dp[i];
  }
  for (int i = 0; i < n; ++i) {
    dp[i] = dp[i] + num[a[i]] * (T - (2 * rep - 1));
  }
  int res = 0;
  for (int i = n; i < n * rep; ++i) {
    dp[i] = find(max(0, i - n), i - 1, a[i]);
    res = max(res, dp[i]);
  }
  cout << res << endl;
}
int main() {
  solve();
  return 0;
}
