#include <bits/stdc++.h>
using namespace std;
int main(int argv, char** argc) {
  cin.sync_with_stdio(0);
  long long n, T;
  cin >> n >> T;
  int nums[n];
  for (typeof(n) i = 0; i < n; i++) {
    cin >> nums[i];
  }
  map<long long, long long> numcount;
  long long mostcount = 0;
  for (typeof(n) i = 0; i < n; i++) {
    numcount[nums[i]]++;
    mostcount = max(mostcount, numcount[nums[i]]);
  }
  vector<int> lisnums;
  long long tomake = min(n, T);
  T -= tomake;
  for (typeof(tomake) i = 0; i < tomake; i++) {
    for (typeof(n) j = 0; j < n; j++) {
      lisnums.push_back(nums[j]);
    }
  }
  vector<long long> lis(lisnums.size(), 1);
  for (typeof(lis.size()) i = 0; i < lis.size(); i++) {
    ;
    for (int j = i - 1; j >= 0; j--) {
      if (lisnums[j] <= lisnums[i]) {
        lis[i] = max(lis[i], lis[j] + 1);
      }
    }
  }
  long long max_lis = *max_element(lis.begin(), lis.end());
  long long answer = max_lis + T * mostcount;
  cout << answer << endl;
  return 0;
}
