#include <bits/stdc++.h>
using namespace std;
int cnt[305];
vector<int> a, b, c;
int n, t;
int nn, nn2;
int dp[10005][305];
int dp2[10005][305];
int tmp;
int solve2(int idx, int bck) {
  if (idx == nn2) return 0;
  int &ret = dp2[idx][bck];
  if (ret != -1) return ret;
  if (c[idx] >= bck) ret = 1 + solve2(idx + 1, c[idx]);
  return ret = max(ret, solve2(idx + 1, bck));
}
int solve(int idx, int bck) {
  if (idx == nn) {
    return t * cnt[bck] + solve2(0, bck);
  }
  int &ret = dp[idx][bck];
  if (ret != -1) return ret;
  ret = 0;
  if (a[idx] >= bck) ret = 1 + solve(idx + 1, a[idx]);
  return ret = max(ret, solve(idx + 1, bck));
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  memset(dp, -1, sizeof dp);
  memset(dp2, -1, sizeof dp2);
  cin >> n >> t;
  b.resize(n);
  for (int i = 0; i < n; i++) {
    cin >> b[i];
    cnt[b[i]]++;
  }
  int i = 0;
  for (; i < min(100, t); i++) {
    for (int j = 0; j < n; j++) a.push_back(b[j]), nn++;
  }
  t -= i;
  tmp = min(i, t);
  t -= tmp;
  i = 0;
  for (; i < tmp; i++) {
    for (int j = 0; j < n; j++) c.push_back(b[j]), nn2++;
  }
  cout << solve(0, 0) << '\n';
  return 0;
}
