#include <bits/stdc++.h>
int gcd(int x, int y) { return (y ? gcd(y, x % y) : x); }
using namespace std;
int main() {
  cin.tie(NULL);
  ios_base::sync_with_stdio(false);
  int n, t;
  cin >> n >> t;
  vector<int> a(n);
  for (auto &x : a) {
    cin >> x;
  }
  vector<pair<int, int> > srt;
  int mi = 0;
  for (int i = 0; i < n; ++i) {
    if (a[mi] > a[i]) {
      mi = i;
    }
    srt.push_back({a[i], i});
  }
  sort(srt.begin(), srt.end());
  reverse(srt.begin(), srt.end());
  vector<vector<vector<int> > > v(
      n, vector<vector<int> >(n + 1, vector<int>(n, -1)));
  for (int i = 0; i < n; ++i) {
    v[i][0][i] = 0;
    for (int j = 0; j < n; ++j) {
      v[i][j + 1] = v[i][j];
      if (a[j] < a[i]) {
        continue;
      }
      for (int z = 0; z < n; ++z) {
        if (a[z] <= a[j]) {
          v[i][j + 1][j] = max(v[i][j + 1][j], v[i][j][z] + 1);
        }
      }
    }
  }
  vector<vector<int> > g(n, vector<int>(n, -1));
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      g[i][j] = v[i][n][j];
    }
  }
  vector<vector<int> > gto(n, vector<int>(n, -1));
  for (int i = 0; i < n; ++i) {
    int vf = srt[i].second;
    gto[vf][0] = 0;
    for (int j = 0; j < i; ++j) {
      int vt = srt[j].second;
      for (int k = 0; k < n - 1; ++k) {
        if (gto[vt][k] != -1 && g[vf][vt] != -1) {
          gto[vf][k + 1] = max(gto[vf][k + 1], gto[vt][k] + g[vf][vt]);
        }
      }
    }
  }
  vector<vector<int> > fromm(n, vector<int>(n, -1));
  fromm[0][mi] = 0;
  for (int i = 1; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      if (fromm[i - 1][j] == -1) {
        continue;
      }
      for (int k = 0; k < n; ++k) {
        if (g[j][k] == -1) {
          continue;
        }
        fromm[i][k] = max(fromm[i][k], fromm[i - 1][j] + g[j][k]);
      }
    }
  }
  int res = 0;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < n; ++j) {
      for (int k = 0; k < n; ++k) {
        if (j + k > t) {
          continue;
        }
        if (fromm[j][i] == -1 || gto[i][k] == -1) {
          continue;
        }
        res = max(res, fromm[j][i] + gto[i][k] + (t - j - k) * g[i][i]);
      }
    }
  }
  cout << res << endl;
  return 0;
}
