#include <bits/stdc++.h>
using namespace std;
long long n, t, cnt[305];
vector<long long> a;
int solvebas(int sz) {
  vector<long long> v;
  vector<long long>::iterator it;
  for (int i = 1; i <= sz; i++) {
    it = upper_bound(v.begin(), v.end(), a[i]);
    if (it == v.end())
      v.push_back(a[i]);
    else
      *it = a[i];
  }
  return v.size();
}
int solve(long long num, long long sz) {
  long long res = 0;
  vector<long long> v;
  vector<long long>::iterator it;
  for (int i = 1; i <= sz; i++) {
    it = upper_bound(v.begin(), v.end(), a[i]);
    if (it == v.end()) {
      if (v.size())
        v.push_back(a[i]);
      else if (a[i] == num)
        v.push_back(a[i]);
    } else {
      if (*it == num) continue;
      *it = a[i];
    }
  }
  return v.size();
}
long long solve2(long long num, long long sz) {
  vector<long long> v;
  vector<long long>::iterator it;
  for (int i = sz; i >= 1; i--) {
    it = upper_bound(v.begin(), v.end(), -a[i]);
    if (it == v.end()) {
      if (v.size())
        v.push_back(-a[i]);
      else if (a[i] == num)
        v.push_back(-a[i]);
    } else {
      if (*it == -num) continue;
      *it = -a[i];
    }
  }
  return v.size();
}
long long soolve(long long num) {
  vector<long long> aa = a;
  long long in, dc, tmp, tmp2;
  for (int i = 1; i <= 100; i++) {
    for (int j = 1; j <= n; j++) a.push_back(a[j]);
  }
  in = solve(num, 100 * n);
  dc = solve2(num, 100 * n);
  tmp = (t - 200) * cnt[num];
  return in + dc + tmp;
}
int main() {
  cin >> n >> t;
  a.push_back(0);
  for (int i = 1; i <= n; i++) {
    int x;
    cin >> x;
    cnt[x]++;
    a.push_back(x);
  }
  if (t <= 500) {
    long long sz = n * t;
    t--;
    int j = n + 1;
    while (t--) {
      for (int i = 1; i <= n; i++) a.push_back(a[i]);
    }
    cout << solvebas(sz) << "\n";
    return 0;
  }
  long long ans = 0;
  for (int i = 1; i <= 300; i++) {
    if (!cnt[i]) continue;
    ans = max(ans, soolve(i));
  }
  cout << ans << "\n";
  return 0;
}
