#include <bits/stdc++.h>
inline int max(int x, int y) { return (x > y ? x : y); }
int n, T, a[500], base[500][500], b[500][500], tmp[500][500], ans[500][500];
void work(int T) {
  if (T == 1) {
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++) ans[i][j] = base[i][j];
    return;
  }
  work(T / 2);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      tmp[i][j] = 0;
      for (int k = 0; k < n; k++)
        if ((ans[i][k]) && (ans[k][j]))
          tmp[i][j] = max(tmp[i][j], ans[i][k] + ans[k][j]);
    }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) ans[i][j] = tmp[i][j];
  if (T % 2) {
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++) {
        tmp[i][j] = 0;
        for (int k = 0; k < n; k++)
          if ((ans[i][k]) && (base[k][j]))
            tmp[i][j] = max(tmp[i][j], ans[i][k] + base[k][j]);
      }
    for (int i = 0; i < n; i++)
      for (int j = 0; j < n; j++) ans[i][j] = tmp[i][j];
  }
}
int main() {
  scanf("%d%d", &n, &T);
  for (int i = 0; i < n; i++) scanf("%d", &a[i]);
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      if (i > j) {
        b[i][j] = 0;
      } else if (i == j) {
        b[i][j] = 1;
      } else if (a[i] > a[j]) {
        b[i][j] = 0;
      } else {
        b[i][j] = 2;
        for (int k = i + 1; k < j; k++)
          if ((a[i] <= a[k]) && (a[k] <= a[j]))
            b[i][j] = max(b[i][j], b[i][k] + 1);
      }
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) {
      base[i][j] = (a[i] <= a[j] ? 1 : 0);
      for (int k = 0; k < n; k++)
        if (a[k] >= a[i]) base[i][j] = max(base[i][j], b[k][j]);
    }
  work(T);
  int ret = 0;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++) ret = max(ret, ans[i][j]);
  printf("%d", ret);
  return 0;
}
