#include <bits/stdc++.h>
using namespace std;
int gcd(int a, int b) { return !b ? a : gcd(b, a % b); }
int A[100], B[40200], n, N, M[40200];
long long r1;
int lis() {
  int L = 0, lo, hi, mid, i;
  for (i = 0; i < N; i++) {
    lo = 1;
    hi = L;
    while (lo <= hi) {
      mid = (lo + hi) / 2 + ((lo + hi) % 2);
      if (B[M[mid]] <= B[i])
        lo = mid + 1;
      else
        hi = mid - 1;
    }
    M[lo] = i;
    if (lo > L) L = lo;
    if (i == N - n - 1) r1 = L;
  }
  return L;
}
int main() {
  int T, i, j, k;
  long long r2;
  scanf("%d%d", &n, &T);
  for (i = 0; i < n; i++) {
    scanf("%d", &A[i]);
  }
  if (T <= 401) {
    for (i = 0, j = 0; i < T; i++)
      for (k = 0; k < n; k++) B[j++] = A[k];
    N = n * T;
    printf("%d\n", lis());
  } else {
    for (i = 0, j = 0; i < 401; i++)
      for (k = 0; k < n; k++) B[j++] = A[k];
    N = 401 * n;
    r2 = lis();
    cout << r1 + (r2 - r1) * (T - 400) << endl;
  }
  return 0;
}
