#include <bits/stdc++.h>
using namespace std;
int LIS(vector<int>& v) {
  int n = v.size();
  vector<int> d(n + 1);
  int INF = 1000000000;
  d[0] = -INF;
  for (int i = 1; i <= n; ++i) d[i] = INF;
  for (int i = 0; i < n; i++) {
    int j = int(upper_bound(d.begin(), d.end(), v[i]) - d.begin());
    if (d[j - 1] <= v[i] && v[i] < d[j]) d[j] = v[i];
  }
  for (int i = n; i >= 0; --i)
    if (d[i] != INF) return i;
}
void sum(vector<int>& a, vector<int>& b) {
  for (int i = 0; i < b.size(); ++i) {
    a.push_back(b[i]);
  }
}
int main() {
  int n, t;
  cin >> n >> t;
  vector<int> v(n);
  int maxval = 500;
  vector<int> count(maxval, 0);
  for (int i = 0; i < n; ++i) {
    cin >> v[i];
    ++count[v[i]];
  }
  vector<int> big;
  int T = min(300, t);
  for (int i = 1; i <= T; ++i) {
    sum(big, v);
  }
  int ans = LIS(big);
  int MAX = -1;
  for (int i = 0; i < maxval; ++i) {
    MAX = max(MAX, count[i]);
  }
  cout << ans + (t - T) * MAX << endl;
  return 0;
}
