#include <bits/stdc++.h>
using namespace std;
int const AMAX = 333;
int a[111], b[AMAX][AMAX];
int main() {
  int n, t;
  scanf("%d%d", &n, &t);
  for (int i = 0; i < n; ++i) {
    scanf("%d", a + i);
  }
  for (int k = 1; k < AMAX; ++k) {
    for (int j = 1; j < AMAX; ++j) {
      b[k][j] = b[k - 1][j];
    }
    for (int i = 0; i < n; ++i) {
      int m = 0;
      for (int j = 1; j <= a[i]; ++j) {
        m = max(m, b[k][j]);
      }
      b[k][a[i]] = m + 1;
    }
  }
  int m = 0;
  if (t < AMAX) {
    for (int j = 1; j < AMAX; ++j) {
      m = max(m, b[t][j]);
    }
  } else {
    for (int j = 1; j < AMAX; ++j) {
      m = max(m, b[AMAX - 1][j] +
                     (b[AMAX - 1][j] - b[AMAX - 2][j]) * (t - AMAX + 1));
    }
  }
  printf("%d", m);
  return 0;
}
