#include <bits/stdc++.h>
using namespace std;
const int N = 1e5 + 3;
int a[103], cnt[500], b[N];
int n, T;
int bit[N];
int mx = 0, SL = 0;
void update(int k, int val) {
  for (; k < N; k += k & -k) bit[k] = max(bit[k], val);
}
int query(int k) {
  int kq = 0;
  for (; k > 0; k -= k & -k) kq = max(kq, bit[k]);
  return kq;
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> T;
  for (int i = 1; i <= n; ++i)
    cin >> a[i], cnt[a[i]]++, mx = max(mx, cnt[a[i]]);
  for (int i = 1; i <= min(n, T); ++i)
    for (int j = 1; j <= n; ++j) b[++SL] = a[j];
  int res = 0;
  for (int i = 1; i <= SL; ++i) {
    int tmp = query(b[i]) + 1;
    update(b[i], tmp);
    res = max(res, tmp);
  }
  res = res + max(0, mx * (T - n));
  cout << res;
}
