#include <bits/stdc++.h>
using namespace std;
int a[15000];
int d[15000];
int b[350];
int main() {
  int n, T;
  cin >> n >> T;
  int maxm = 1;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    b[a[i]]++;
    maxm = max(maxm, b[a[i]]);
  }
  int t = min(n, T);
  int cnt = n;
  int tt = t;
  while (tt--) {
    for (int i = 0; i < n; i++) a[i + cnt] = a[i];
    cnt += n;
  }
  for (int i = 0; i <= n * t; i++) d[i] = (1 << 25);
  for (int i = 0; i < n * t; i++) {
    *upper_bound(d, d + n * t, a[i]) = a[i];
  }
  int ans = lower_bound(d, d + n * t, (1 << 25)) - d;
  ans += (T - t) * maxm;
  cout << ans << endl;
  return 0;
}
