2670.Once Again

Time Limit: 1s Memory Limit: 256MB

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

Input Format(From the terminal/stdin)

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

Output Format(To the terminal/stdout)

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

Sample Input

Copy
4 3
3 1 4 2
 · \n
 · · · \n

Sample Output

Copy
5
 \n

Hints

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.

Submit

请先 登录

© 2025 FAQs