#include <bits/stdc++.h>
using namespace std;
int arr[500];
int valCnt[500];
int lcs[50000];
int lcsCnt;
int main() {
  int n, t;
  scanf("%d%d", &n, &t);
  int i, tTime = 0, maxValCnt = 0;
  for (i = 1; i <= n; i++) {
    scanf("%d", &arr[i]);
    valCnt[arr[i]]++;
    if (valCnt[arr[i]] > valCnt[maxValCnt]) maxValCnt = arr[i];
  }
  for (tTime = 1; tTime <= t; tTime++) {
    if (tTime > 2 * n) break;
    for (i = 1; i <= n; i++) {
      if (arr[i] >= lcs[lcsCnt]) {
        lcsCnt++;
        lcs[lcsCnt] = arr[i];
      } else {
        int l = 0, r = lcsCnt, mid;
        while (r - l > 0) {
          mid = (l + r + 1) / 2;
          if (arr[i] >= lcs[mid])
            l = mid;
          else
            r = mid - 1;
        }
        mid = (l + r + 1) / 2;
        lcs[mid + 1] = arr[i];
      }
    }
  }
  if (t <= 2 * n)
    printf("%d\n", lcsCnt);
  else
    printf("%d\n", lcsCnt + (t - 2 * n) * valCnt[maxValCnt]);
  return 0;
}
