A football coach is preparing a penalty shootout lineup for a FIFA World Cup knockout match.
There are
The confidence value of player
The coach wants to choose exactly
However, to avoid pressure between nearby players, no two chosen players can be adjacent in the given order.
Your task is to find the maximum total confidence of exactly
The first line contains two integers KaTeX can only parse string typed expression and KaTeX can only parse string typed expression — the number of players and the number of players to choose.
The second line contains KaTeX can only parse string typed expression integers KaTeX can only parse string typed expression — the confidence values of the players.
Print a single integer — the maximum total confidence of exactly KaTeX can only parse string typed expression chosen players such that no two chosen players are adjacent.
If it is impossible, print KaTeX can only parse string typed expression.
Input
5 2
10 50 20 60 30Output110ExplanationChoose player KaTeX can only parse string typed expression and player KaTeX can only parse string typed expression.
They are not adjacent, and the total confidence is KaTeX can only parse string typed expression.
Example 2:
Input
3 3
5 10 20Output-1ExplanationIt is impossible to choose all KaTeX can only parse string typed expression players because adjacent players cannot both be chosen.