#include <bits/stdc++.h>
using namespace std;
int n, A[105], T, dp[10000000], C[10000000];
struct Bit {
  int num[105 * 3], upl;
  Bit() { memset(num, 0, sizeof(num)); }
  void Add(int x, int a) {
    while (x <= upl) {
      num[x] = max(num[x], a);
      x += (x & -x);
    }
  }
  int Ask(int x) {
    int res = 0;
    while (x) {
      res = max(num[x], res);
      x -= x & -x;
    }
    return res;
  }
} Tr;
int cnt[305];
int main() {
  scanf("%d %d", &n, &T);
  for (int i = 0; i < n; i++) scanf("%d", &A[i]), cnt[A[i]]++;
  int ans = 0, k = 0;
  int m = min(n, T), mx = 0;
  for (int i = 0; i < m; i++) {
    for (int j = 0; j < n; j++) C[k++] = A[j], mx = max(cnt[A[i]], mx);
  }
  Tr.upl = 304;
  for (int i = 0; i < k; i++) {
    dp[i] = Tr.Ask(A[i % n]) + 1;
    Tr.Add(A[i % n], dp[i]);
    ans = max(ans, dp[i] + (T - m) * mx);
  }
  printf("%d\n", ans);
  return 0;
}
