#include <bits/stdc++.h>
using namespace std;
const int N = 105;
int dp[N * N], a[N], b[N * N], mp[305];
int main() {
  int n, t;
  scanf("%d%d", &n, &t);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    mp[a[i]]++;
  }
  int m = 0;
  for (int i = 0; i < min(n, t); i++)
    for (int j = 1; j <= n; j++) {
      b[++m] = a[j];
    }
  int len = 0;
  dp[len++] = a[1];
  for (int i = 2; i <= m; i++) {
    if (b[i] >= dp[len - 1]) {
      dp[len++] = b[i];
      continue;
    }
    int pos = upper_bound(dp, dp + len, b[i]) - dp;
    dp[pos] = b[i];
  }
  int res = len;
  int maxn = 0;
  for (int i = 1; i <= 300; i++) {
    if (mp[i] == 0) continue;
    maxn = max(maxn, mp[i]);
  }
  if (t > n) {
    res += (t - n) * maxn;
  }
  printf("%d\n", res);
}
