#include <bits/stdc++.h>
using namespace std;
bool compare(int lhs, int rhs) {
  if (lhs > rhs) {
    return true;
  }
  return false;
}
long long int MAX(long long int a, long long int b) {
  if (a > b) return a;
  return b;
}
int GCD(int a, int b) {
  int x = MAX(a, b);
  int y = ((b) ^ (((a) ^ (b)) & -((a) < (b))));
  if (x % y == 0) {
    return y;
  } else {
    return GCD(x % y, y);
  }
}
long long fast_pow(int a, int n) {
  long long result = 1;
  long long power = n;
  long long value = a;
  while (power > 0) {
    if (power & 1) {
      result = result * value;
      result = result % 1000000007;
    }
    value = value * value;
    value = value % 1000000007;
    power /= 2;
  }
  return result;
}
int pow_k(long long int N, long long int K) {
  int count = 0;
  while (N > 1) {
    N /= K;
    count++;
  }
  return count;
}
int count_bit(int N) {
  int count = 0;
  for (int i = 0; i < 32; i++) {
    if (N & (1 << i)) {
      count++;
    }
  }
  return count;
}
int height[10001];
int s[10001];
int binary_search(int first, int last, int x) {
  while (last > first) {
    int mid = first + (last - first) / 2;
    if (height[s[mid]] > x)
      last = mid;
    else
      first = mid + 1;
  }
  return first;
}
int longest_increasing_subsequence_nlgn(int n) {
  int i, k, index;
  memset(s, 0, sizeof(s));
  index = 1;
  s[1] = 0;
  for (i = 1; i < n; i++) {
    if (height[i] >= height[s[index]]) {
      index++;
      s[index] = i;
    } else {
      k = binary_search(1, index, height[i]);
      if (height[s[k]] >= height[i]) {
        s[k] = i;
      }
    }
  }
  return index;
}
int arr[301] = {0};
int main() {
  int N, T;
  cin >> N >> T;
  int k = ((T) ^ (((N) ^ (T)) & -((N) < (T))));
  for (int i = 0; i < N; i++) {
    cin >> height[i];
    arr[height[i]]++;
  }
  for (int i = 1; i < k; i++) {
    for (int j = 0; j < N; j++) {
      height[i * N + j] = height[j];
    }
  }
  int len = longest_increasing_subsequence_nlgn(k * N);
  long long int max = 0;
  for (int i = 0; i < 301; i++) {
    if (arr[i] > max) max = arr[i];
  }
  if (k == T)
    cout << len;
  else {
    cout << (long long int)max * (long long int)(T - k) + (long long int)len;
  }
  return 0;
}

### Prompt

In Cpp, your task is to solve the following problem:

You are given an array of positive integers a1, a2, ..., an × T of length n × T. We know that for any i > n it is true that ai = ai - n. Find the length of the longest non-decreasing sequence of the given array.

Input

The first line contains two space-separated integers: n, T (1 ≤ n ≤ 100, 1 ≤ T ≤ 107). The second line contains n space-separated integers a1, a2, ..., an (1 ≤ ai ≤ 300).

Output

Print a single number — the length of a sought sequence.

Examples

Input

4 3
3 1 4 2


Output

5

Note

The array given in the sample looks like that: 3, 1, 4, 2, 3, 1, 4, 2, 3, 1, 4, 2. The elements in bold form the largest non-decreasing subsequence. 

### Response

```cpp
#include <bits/stdc++.h>
using namespace std;
bool compare(int lhs, int rhs) {
  if (lhs > rhs) {
    return true;
  }
  return false;
}
long long int MAX(long long int a, long long int b) {
  if (a > b) return a;
  return b;
}
int GCD(int a, int b) {
  int x = MAX(a, b);
  int y = ((b) ^ (((a) ^ (b)) & -((a) < (b))));
  if (x % y == 0) {
    return y;
  } else {
    return GCD(x % y, y);
  }
}
long long fast_pow(int a, int n) {
  long long result = 1;
  long long power = n;
  long long value = a;
  while (power > 0) {
    if (power & 1) {
      result = result * value;
      result = result % 1000000007;
    }
    value = value * value;
    value = value % 1000000007;
    power /= 2;
  }
  return result;
}
int pow_k(long long int N, long long int K) {
  int count = 0;
  while (N > 1) {
    N /= K;
    count++;
  }
  return count;
}
int count_bit(int N) {
  int count = 0;
  for (int i = 0; i < 32; i++) {
    if (N & (1 << i)) {
      count++;
    }
  }
  return count;
}
int height[10001];
int s[10001];
int binary_search(int first, int last, int x) {
  while (last > first) {
    int mid = first + (last - first) / 2;
    if (height[s[mid]] > x)
      last = mid;
    else
      first = mid + 1;
  }
  return first;
}
int longest_increasing_subsequence_nlgn(int n) {
  int i, k, index;
  memset(s, 0, sizeof(s));
  index = 1;
  s[1] = 0;
  for (i = 1; i < n; i++) {
    if (height[i] >= height[s[index]]) {
      index++;
      s[index] = i;
    } else {
      k = binary_search(1, index, height[i]);
      if (height[s[k]] >= height[i]) {
        s[k] = i;
      }
    }
  }
  return index;
}
int arr[301] = {0};
int main() {
  int N, T;
  cin >> N >> T;
  int k = ((T) ^ (((N) ^ (T)) & -((N) < (T))));
  for (int i = 0; i < N; i++) {
    cin >> height[i];
    arr[height[i]]++;
  }
  for (int i = 1; i < k; i++) {
    for (int j = 0; j < N; j++) {
      height[i * N + j] = height[j];
    }
  }
  int len = longest_increasing_subsequence_nlgn(k * N);
  long long int max = 0;
  for (int i = 0; i < 301; i++) {
    if (arr[i] > max) max = arr[i];
  }
  if (k == T)
    cout << len;
  else {
    cout << (long long int)max * (long long int)(T - k) + (long long int)len;
  }
  return 0;
}

```