#include <bits/stdc++.h>
using namespace std;
int cnt[305];
int num[305];
int d[305];
int main() {
  int n, t;
  cin >> n >> t;
  memset(cnt, 0, sizeof(cnt));
  int Max = 0;
  for (int i = 1; i <= n; i++) {
    cin >> num[i];
    cnt[num[i]]++;
    Max = max(Max, cnt[num[i]]);
  }
  int temp = min(t, 99);
  for (int i = 1; i <= temp; i++) {
    for (int j = 1; j <= n; j++) {
      int sum = 0;
      for (int k = 1; k <= n; k++) {
        if (num[k] <= num[j]) sum = max(sum, d[k] + 1);
      }
      d[j] = sum;
    }
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) ans = max(ans, d[i]);
  cout << ans + (t - temp) * Max << endl;
}
