#include <bits/stdc++.h>
using namespace std;
const int N = 30001;
int a[N], f[N], d[N];
int bsearch(const int *f, int size, const int &a) {
  int l = 0, r = size - 1;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (a >= d[mid - 1] && a < d[mid])
      return mid;
    else if (a < d[mid])
      r = mid - 1;
    else
      l = mid + 1;
  }
}
int LIS(const int *a, const int &n) {
  int i, j, size = 1;
  d[0] = a[0];
  f[0] = 1;
  for (i = 1; i < n; ++i) {
    if (a[i] < d[0])
      j = 0;
    else if (a[i] >= d[size - 1])
      j = size++;
    else
      j = bsearch(d, size, a[i]);
    d[j] = a[i];
    f[i] = j + 1;
  }
  return size;
}
int main() {
  int n, t;
  while (scanf("%d%d", &n, &t) != EOF) {
    for (int i = 0; i < n; ++i) scanf("%d", &a[i]);
    if (t < 103) {
      for (int i = 1; i < t; i++)
        for (int j = 0; j < n; j++) a[i * n + j] = a[j];
      printf("%d", LIS(a, n * t));
    } else {
      for (int i = 1; i < 103; i++)
        for (int j = 0; j < n; j++) a[i * n + j] = a[j];
      int zzz = LIS(a, n * 103);
      for (int j = 0; j < n; j++) a[103 * n + j] = a[j];
      int zzz2 = LIS(a, n * 104);
      printf("%d", zzz + (zzz2 - zzz) * (t - 103));
    }
  }
  return 0;
}
