HomeVolumesContestsSectionsForumsUsersPrintHelpAbout

Volumes > C. T. 2011 > problem:


Maximum Sum

Volume problems

• Bookshelf
• Coin Game
• Butterfly
• Word power
• Buying hay
• Best Grass
• Cow PinBall
• Cow Sorting
• Maximum Sum
• Making Change
• Colored hills
• Word Statistics
• Going to the Movies
• A to the power of B
• Connected components
• Binary transformations
• Fleas

Feedback

If you notice incorrect translations in Contester, please let author know.

Time limit 2000/2000/4000/4000 ms. Memory limit 65000/65000/65000/65000 Kb.

Problem Description

There is a line of N (1 <= N <= 1.000.000) integers (each between -10.000 and 10.000). You can take a segment of M  (M <= N) numbers. What is the maximum sum you can have in your segment?

Input

The input file has two lines: There are two integers in the first line: N and M.  There are N integers in the second line representing the numbers in the line.

Output

Display the maximum sum you can make in your segment.

Example

input output

9 3
1 2 3 -2 4 6 -3 2 3

8

 

Для отправки решений необходимо выполнить вход.

www.contester.ru