#include <bits/stdc++.h>
const int N = 105;
const int LIM = 305;
int n, ti;
int a[N];
int b[N * LIM * 2];
int f[2][N * LIM * 2];
int lowbit(int x) { return x & (-x); }
struct Fenwick_Tree {
  int e[LIM];
  void clear() { std::fill(e + 1, e + 300 + 1, 0); }
  void add(int pos, int delta) {
    for (int i = pos; i <= 300; i += lowbit(i)) {
      e[i] = std::max(e[i], delta);
    }
  }
  int get_max(int pos) {
    int ret = 0;
    for (int i = pos; i >= 1; i -= lowbit(i)) {
      ret = std::max(ret, e[i]);
    }
    return ret;
  }
};
void init() {
  std::cin >> n >> ti;
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
}
void get_f(int size) {
  static Fenwick_Tree ft;
  ft.clear();
  std::fill(f[0] + 1, f[0] + size + 1, 0);
  for (int i = 1; i <= size; i++) {
    f[0][i] = ft.get_max(b[i]) + 1;
    ft.add(b[i], f[0][i]);
  }
  ft.clear();
  std::fill(f[1] + 1, f[1] + size + 1, 0);
  for (int i = size; i >= 1; i--) {
    f[1][i] = ft.get_max(300 - b[i] + 1) + 1;
    ft.add(300 - b[i] + 1, f[1][i]);
  }
}
void work() {
  if (ti <= 600) {
    int tot = 0;
    for (int t = 1; t <= ti; t++) {
      for (int i = 1; i <= n; i++) {
        b[++tot] = a[i];
      }
    }
    get_f(ti * n);
    std::cout << *std::max_element(f[0] + 1, f[0] + ti * n + 1) << std::endl;
  } else {
    int tot = 0;
    for (int t = 1; t <= 300; t++) {
      for (int i = 1; i <= n; i++) {
        b[++tot] = a[i];
      }
    }
    get_f(300 * n);
    static int count[LIM], max[LIM][LIM];
    static int best[2][LIM];
    for (int i = 1; i <= n; i++) {
      count[a[i]]++;
    }
    for (int i = 1; i <= 300; i++) {
      for (int j = i; j <= 300; j++) {
        max[i][j] = 0;
        for (int k = i; k <= j; k++) {
          max[i][j] = std::max(max[i][j], count[k]);
        }
      }
    }
    memset(best, 0, sizeof(best));
    for (int i = 1; i <= 300 * n; i++) {
      best[0][b[i]] = std::max(best[0][b[i]], f[0][i]);
      best[1][b[i]] = std::max(best[1][b[i]], f[1][i]);
    }
    int ans = 0;
    for (int i = 1; i <= 300; i++) {
      for (int j = i; j <= 300; j++) {
        ans = std::max(ans, best[0][i] + max[i][j] * (ti - 600) + best[1][j]);
      }
    }
    std::cout << ans << std::endl;
  }
}
int main() {
  init();
  work();
  return 0;
}
