#include <bits/stdc++.h>
using namespace std;
int n, T, x;
vector<int> A, B;
vector<int> dp;
vector<int> res;
vector<int> fa;
int cnt[305];
int main() {
  scanf("%d%d", &n, &T);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &x);
    A.push_back(x);
    cnt[x]++;
  }
  if (n >= T) {
    for (int i = 0; i < T; i++)
      for (int j = 0; j < A.size(); j++) B.push_back(A[j]);
    dp.push_back(0);
    for (int i = 0; i < B.size(); i++) {
      x = upper_bound(dp.begin(), dp.end(), B[i]) - dp.begin();
      if (x == dp.size())
        dp.push_back(B[i]);
      else
        dp[x] = B[i];
    }
    cout << dp.size() - 1 << endl;
  } else if (n < T) {
    for (int i = 0; i < n; i++)
      for (int j = 0; j < A.size(); j++) B.push_back(A[j]);
    dp.push_back(0);
    fa.push_back(-1);
    for (int i = 0; i < B.size(); i++) {
      x = upper_bound(dp.begin(), dp.end(), B[i]) - dp.begin();
      if (x == dp.size())
        dp.push_back(B[i]);
      else
        dp[x] = B[i];
      res.push_back(dp.size() - 1);
      fa.push_back(fa[x - 1]);
    }
    int ans = dp.size() - 1;
    for (int i = 0; i < res.size(); i++) {
      int sa = i;
      int sb = fa[i + 1];
      if (sb != -1 && (sa / n == sb / n)) continue;
      for (int j = ((sb == -1) ? 1 : B[sb]); j <= B[sa]; j++) {
        ans = max(ans, (int)dp.size() - 1 + (T - n) * (cnt[j]));
      }
      if (res[i] == dp.size() - 1) {
        for (int j = B[i]; j <= 300; j++)
          ans = max(ans, (int)dp.size() - 1 + (T - n) * (cnt[j]));
      }
    }
    cout << ans << endl;
  }
  return 0;
}
