#include <bits/stdc++.h>
using namespace std;
const int N = 10000 + 10;
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 n, T;
const int maxn = 300 + 10;
int num[maxn];
int main() {
  scanf("%d %d", &n, &T);
  memset(num, 0, sizeof(num));
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    num[a[i]]++;
  }
  int Max = 0;
  for (int i = 0; i < n; i++) {
    if (num[a[i]] > Max) Max = num[a[i]];
  }
  if (n >= T) {
    for (int i = n; i < n * T; i++) a[i] = a[i - n];
    int ans = LIS(a, n * T);
    printf("%d", ans);
  } else {
    for (int i = n; i <= n * n; i++) a[i] = a[i - n];
    int ans = LIS(a, n * n);
    ans = ans + (T - n) * Max;
    printf("%d", ans);
  }
}
