#include <bits/stdc++.h>
using namespace std;
int dp[10007];
int s[10007];
int a[10007];
int cnt[307];
int n, t, ans;
int main() {
  while (~scanf("%d%d", &n, &t)) {
    memset(cnt, 0, sizeof(cnt));
    for (int i = 1; i <= n; i++) {
      scanf("%d", &a[i]);
      cnt[a[i]]++;
    }
    int total = min(t, n) * n;
    for (int i = n + 1; i <= total; i++) a[i] = a[i - n];
    s[0] = 0;
    int top = 0;
    for (int i = 1; i <= total; i++) {
      int l = 0, r = top, mid;
      while (l != r) {
        mid = (l + r + 1) >> 1;
        if (s[mid] <= a[i])
          l = mid;
        else
          r = mid - 1;
      }
      ans = max(ans, l + 1);
      if (ans > top)
        s[++top] = a[i];
      else
        s[l + 1] = min(s[l + 1], a[i]);
    }
    int maxn = 0;
    for (int i = 1; i <= 300; i++) maxn = max(maxn, cnt[i]);
    ans += max(t - n, 0) * maxn;
    printf("%d\n", ans);
  }
}
