#include <bits/stdc++.h>
using namespace std;
int tr[1024] = {};
int M;
void init_tree(int n) {
  M = 1;
  while (M < n + 2) M <<= 1;
}
void change(int pos, int v) {
  pos += M;
  tr[pos] = v;
  pos >>= 1;
  while (pos) {
    tr[pos] = max(tr[pos << 1], tr[(pos << 1) | 1]);
    pos >>= 1;
  }
}
int get(int l, int r) {
  int res = 0;
  for (l += M - 1, r += M + 1; l ^ r ^ 1; l >>= 1, r >>= 1) {
    if (~l & 1) res = max(res, tr[l ^ 1]);
    if (r & 1) res = max(res, tr[r ^ 1]);
  }
  return res;
}
int a[305];
int cnt[305] = {};
void solve() {
  int n, T;
  cin >> n >> T;
  init_tree(300);
  for (int i = 0; i < n; ++i) scanf("%d", a + i);
  int t = min(n, T);
  for (int j = 0; j < t; ++j)
    for (int i = 0; i < n; ++i) {
      int s = get(1, a[i]) + 1;
      change(a[i], s);
    }
  for (int i = 0; i < n; ++i) cnt[a[i]]++;
  int mx = 0;
  for (int i = 1; i <= 300; ++i) mx = max(mx, cnt[i]);
  cout << get(1, 300) + (T - t) * mx << endl;
}
int main() {
  solve();
  return 0;
}
