#include <bits/stdc++.h>
using namespace std;
void fre() {
  freopen("c://test//input.in", "r", stdin);
  freopen("c://test//output.out", "w", stdout);
}
template <class T1, class T2>
inline void gmax(T1 &a, T2 b) {
  if (b > a) a = b;
}
template <class T1, class T2>
inline void gmin(T1 &a, T2 b) {
  if (b < a) a = b;
}
const int N = 1e4 + 1e3, M = 0, Z = 1e9 + 7, ms63 = 1061109567;
int casenum, casei;
int n, m, T;
int a[N], f[N];
int main() {
  while (~scanf("%d%d", &n, &T)) {
    int cir = min(100, T);
    int len = cir * n;
    for (int i = 1; i <= n; i++) scanf("%d", &a[i]);
    int ans = 0;
    for (int i = 1; i <= len; i++) {
      if (i > n) a[i] = a[i - n];
      f[i] = 1;
      int st = max(1, i - n);
      for (int j = st; j < i; j++)
        if (a[j] <= a[i]) gmax(f[i], f[j] + 1);
      gmax(ans, f[i]);
    }
    if (T > cir) {
      int now = 0;
      for (int i = len + 1; i <= len + n; i++) {
        a[i] = a[i - n];
        f[i] = 1;
        for (int j = i - n; j < i; j++)
          if (a[j] <= a[i]) gmax(f[i], f[j] + 1);
        gmax(now, f[i]);
      }
      int dif = now - ans;
      ans += (T - cir) * dif;
    }
    printf("%d\n", ans);
  }
  return 0;
}
