#include <bits/stdc++.h>
using namespace std;
#pragma comment(linker, "/STACK:1024000000,1024000000")
int fst[10000007], nxt[2000200], e;
long long num[2000200], vv[2000200];
void add(int a, int b, int c, long long val) {
  long long t = a;
  t = t * 100 + b;
  t = t * 100 + c;
  int s = t % 10000007;
  ++e;
  num[e] = t, vv[e] = val, nxt[e] = fst[s], fst[s] = e;
}
long long query(int a, int b, int c) {
  long long t = a;
  t = t * 100 + b;
  t = t * 100 + c;
  int s = t % 10000007;
  for (int i = fst[s]; i; i = nxt[i]) {
    long long n = num[i];
    long long val = vv[i];
    if (n == t) return val;
  }
  return -1;
}
int a[520], san[520], cnt;
int dp[520][520];
int s[520];
int n, T;
int haxi(int x) { return lower_bound(san + 1, san + cnt + 1, x) - san; }
long long f(int k, int l, int r) {
  if (k == 1) return dp[l][r];
  long long t = query(k, l, r);
  if (t != -1) return t;
  long long ret = 0;
  if (k % 2 == 0) {
    for (int i = l; i <= r; ++i) {
      long long t1 = f(k / 2, l, i);
      long long t2 = f(k / 2, i, r);
      ret = max(ret, t1 + t2);
    }
  } else {
    for (int i = l; i <= r; ++i) {
      long long t1 = f(k - 1, l, i);
      long long t2 = dp[i][r];
      ret = max(ret, t1 + t2);
    }
  }
  add(k, l, r, ret);
  return ret;
}
int main() {
  while (scanf("%d%d", &n, &T) != EOF) {
    cnt = 0;
    for (int i = 1; i <= n; ++i) {
      scanf("%d", &a[i]);
      san[++cnt] = a[i];
    }
    sort(san + 1, san + cnt + 1);
    cnt = unique(san + 1, san + cnt + 1) - san - 1;
    for (int i = 1; i <= n; ++i) {
      a[i] = haxi(a[i]);
    }
    memset(dp, 0, sizeof dp);
    for (int i = 1; i <= n; ++i) {
      memset(s, 0, sizeof s);
      s[i] = 1;
      dp[a[i]][a[i]] = max(dp[a[i]][a[i]], 1);
      for (int j = i + 1; j <= n; ++j) {
        for (int k = i; k < j; ++k) {
          if (s[k] == 0 || a[k] > a[j]) continue;
          s[j] = max(s[j], s[k] + 1);
        }
        dp[a[i]][a[j]] = max(dp[a[i]][a[j]], s[j]);
      }
    }
    for (int k = 1; k <= n; ++k) {
      for (int i = 1; i + k - 1 <= n; ++i) {
        if (k == 1) continue;
        int j = i + k - 1;
        dp[i][j] = max(dp[i][j], dp[i + 1][j]);
        dp[i][j] = max(dp[i][j], dp[i][j - 1]);
      }
    }
    printf("%I64d\n", f(T, 1, cnt));
  }
  return 0;
}
