#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, t, a[110], dp[10010], len = 0, num[110], Max = 0;
  memset(num, 0, sizeof(num));
  scanf("%d%d", &n, &t);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
    num[a[i]]++;
    Max = max(Max, num[a[i]]);
  }
  int k = min(n, t);
  dp[len++] = a[0];
  for (int i = 1; i < n * k; i++) {
    if (a[i % n] >= dp[len - 1])
      dp[len++] = a[i % n];
    else
      dp[upper_bound(dp, dp + len, a[i % n]) - dp] = a[i % n];
  }
  if (t > n) {
    len += Max * (t - n);
  }
  printf("%d\n", len);
  return 0;
}
