#include <bits/stdc++.h>
using namespace std;
const int maxn = 100 * 110 + 10;
int a[maxn], d[maxn];
int n, T;
int main() {
  while (scanf("%d%d", &n, &T) != EOF) {
    int ans = 0;
    for (int i = 0; i < n; i++) scanf("%d", &a[i]);
    int len = min(100, T) * n;
    for (int i = 0; i < len; i++) {
      if (i >= n) a[i] = a[i - n];
      d[i] = 1;
      for (int j = 0; j < i; j++) {
        if (a[j] <= a[i]) d[i] = max(d[i], d[j] + 1);
      }
      ans = max(ans, d[i]);
    }
    if (T > 100) {
      int cur = 0;
      for (int i = n; i < len + n; i++) {
        a[i] = a[i - n];
        d[i] = 1;
        for (int j = 0; j < i; j++) {
          if (a[j] <= a[i]) d[i] = max(d[i], d[j] + 1);
        }
        cur = max(cur, d[i]);
      }
      ans = ans + (T - 100) * (cur - ans);
    }
    cout << ans << endl;
  }
  return 0;
}
