#include <bits/stdc++.h>
using namespace std;
int arr[101];
int lis[200101];
int solve_another_more(int n, int t, int more, bool less) {
  int nt = n * t, c = 0;
  for (int j = 0; j < t; j++) {
    for (int i = 0; i < n; i++) {
      if (less == false && arr[i] < more)
        continue;
      else if (less == true && arr[i] > more)
        continue;
      int place = upper_bound(lis, lis + c, arr[i]) - lis;
      if (place == c) c++;
      lis[place] = arr[i];
    }
  }
  return c;
}
map<int, int> M;
int main() {
  int n, t;
  scanf("%d%d", &n, &t);
  for (int i = 0; i < n; i++) {
    scanf("%d", arr + i);
    M[arr[i]]++;
  }
  if (n * t <= 200000) {
    printf("%d\n", solve_another_more(n, t, 0, 0));
    return 0;
  }
  int element = arr[0], maxcount = M[arr[0]];
  for (map<int, int>::iterator it = M.begin(); it != M.end(); it++) {
    if (it->second > maxcount) {
      maxcount = it->second;
      element = it->first;
    }
  }
  printf("%d\n", solve_another_more(n, 300, element, false) +
                     solve_another_more(n, 300, element, true) +
                     (t - 600) * maxcount);
  return 0;
}
