#include <bits/stdc++.h>
using namespace std;
long long poww(long long a, long long n) {
  if (n == 0) return 1LL;
  if (n == 1) return a % 1000000007;
  long long v = poww(a, n / 2);
  v = (v * v) % 1000000007;
  if (n % 2) {
    v = (v * a) % 1000000007;
  }
  return v;
}
long long n, t;
long long arr[100005];
long long A[1005];
long long BIT[305];
long long maxele[305];
long long read(long long x) {
  long long val = 0;
  for (; x >= 0; x -= (x & -x)) {
    val = max(val, BIT[x]);
    if (!x) break;
  }
  return val;
}
void upd(long long x, long long val) {
  for (; x <= 300; x += (x & -x)) {
    BIT[x] = max(BIT[x], val);
    if (!x) break;
  }
}
int main() {
  cin >> n >> t;
  long long idx = 0;
  long long valu = 0;
  for (long long i = 1; i <= n; ++i) {
    cin >> A[i];
    maxele[A[i]]++;
    if (valu < maxele[A[i]]) {
      valu = maxele[A[i]];
      idx = A[i];
    }
  }
  for (long long tt = 1; tt <= min(100LL, t); ++tt) {
    for (long long i = 1; i <= n; ++i) {
      arr[(tt - 1) * n + i] = A[i];
    }
  }
  long long tot = min(100LL, t) * n;
  long long rem = t - min(100LL, t);
  long long maxi = 0;
  for (long long i = 1; i <= tot; ++i) {
    long long val = read(arr[i]) + 1;
    maxi = max(maxi, val);
    upd(arr[i], val);
  }
  cout << maxi + rem * valu;
  return 0;
}
