#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int a[100 + 5];
int dp[30005];
int hashs[400];
int main() {
  int n = read();
  int T = read();
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 0; i <= n * 102; i++) dp[i] = 1;
  if (T <= 100) {
    for (int i = 1; i <= T; i++) {
      for (int j = 1; j <= n; j++) {
        for (int k = 1; k < j + n * (i - 1); k++) {
          int tmp = k % n;
          if (tmp == 0) tmp = n;
          if (a[j] >= a[tmp])
            dp[j + n * (i - 1)] = max(dp[j + n * (i - 1)], dp[k] + 1);
        }
      }
    }
    int mm = -1;
    for (int i = 1; i <= n * T; i++) mm = max(dp[i], mm);
    cout << mm << endl;
  } else {
    for (int i = 1; i <= 100; i++) {
      for (int j = 1; j <= n; j++) {
        for (int k = 1; k < j + n * (i - 1); k++) {
          int tmp = k % n;
          if (tmp == 0) tmp = n;
          if (a[j] >= a[tmp])
            dp[j + n * (i - 1)] = max(dp[j + n * (i - 1)], dp[k] + 1);
        }
      }
    }
    int mm = -1, flag, ans = 0;
    for (int i = 1; i <= n * 100; i++) mm = max(dp[i], mm);
    for (int i = 1; i <= n; i++) {
      hashs[a[i]]++;
      if (hashs[a[i]] > ans) ans = hashs[a[i]];
    }
    cout << mm + (T - 100) * ans << endl;
  }
  return 0;
}
