跳到主要内容
图灵 OJTURING / ONLINE JUDGE

#F1547. Once Again

  • ID: 1553
  • 传统题
  • 2000ms
  • 256MiB
  • 尝试: 0
  • AC · 已通过: 0
  • 教学难度:提高
  • 上传者:
  • 构造
  • 动态规划
  • 矩阵运算
  • 算法思想
  • 数学
  • 提高
  • 难度
  • 共享题库
  • Codeforces
  • 英文题面
  • 题目来源
  • 题面语言

Once Again

题目描述

B. Once Again...
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

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.


题目来源:fps-www.educg.net-codeforce-1-2833.xml.zip;FPS 共享题包,题包内第 1066 题。保留原作者与原赛事署名。