#include <bits/stdc++.h>
using namespace std;
template <class T>
inline bool rd(T &ret) {
  char c;
  int sgn;
  if (c = getchar(), c == EOF) return 0;
  while (c != '-' && (c < '0' || c > '9')) c = getchar();
  sgn = (c == '-') ? -1 : 1;
  ret = (c == '-') ? 0 : (c - '0');
  while (c = getchar(), c >= '0' && c <= '9') ret = ret * 10 + (c - '0');
  ret *= sgn;
  return 1;
}
template <class T>
inline void pt(T x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x > 9) pt(x / 10);
  putchar(x % 10 + '0');
}
const int mod = 1e9 + 7;
const int N = 1e5 + 3000;
const int M = 305;
long long m;
int n;
int a[N];
int cnt[M], pre[M], aft[M];
int dp[M];
int main() {
  rd(n);
  rd(m);
  int ma = 1;
  for (int i = 1; i <= n; i++) {
    rd(a[i]);
    cnt[a[i]]++;
    ma = max(ma, cnt[a[i]]);
  }
  int top = n + 1;
  m--;
  while (top + n <= 1e5 && m) {
    for (int i = 1; i <= n; i++) a[top++] = a[i];
    m--;
  }
  memset(dp, 0, sizeof dp);
  for (int j = 1; j < top; j++) {
    int tmp = 0;
    for (int k = 1; k <= a[j]; k++) tmp = max(tmp, dp[k]);
    dp[a[j]] = max(dp[a[j]], tmp + 1);
  }
  int ans = 0;
  for (int j = 1; j <= 300; j++) ans = max(ans, dp[j]);
  ans += ma * m;
  pt(ans);
  return 0;
}
