ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Сборники > C. T. 2011 > задача:


Maximum Sum

Задачи сборника

• A to the power of B
• T-shirts
• GCF
• Maximum Sum
• Making Change
• Best Grass
• Heap
• Bfs
• Chess
• Big Dance
• Binary transformations
• Dijkstra

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/2000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.

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