#include <bits/stdc++.h>
using namespace std;
const int N = 110;
int a[N * N], n, T, dp[N * N], rec[305];
int cal(int x) {
  int m = n * x, len = 0;
  for (int i = 1; i <= m; i++) {
    if (a[i] >= dp[len])
      dp[++len] = a[i];
    else {
      int pos = upper_bound(dp + 1, dp + len + 1, a[i]) - dp;
      dp[pos] = a[i];
    }
  }
  return len;
}
int main() {
  scanf("%d%d", &n, &T);
  for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
  for (int i = 1; i < n; i++) {
    for (int j = 1; j <= n; j++) {
      a[i * n + j] = a[j];
    }
  }
  if (T <= n)
    printf("%d\n", cal(T));
  else {
    memset(rec, 0, sizeof(rec));
    for (int i = 1; i <= n; i++) ++rec[a[i]];
    int tmp = 0;
    for (int i = 1; i <= n; i++) tmp = max(tmp, rec[a[i]]);
    int ans = tmp * (T - n) + cal(n);
    printf("%d\n", ans);
  }
  return 0;
}
