## BSSPC '21 S3 - James's Egirl Discord Status

View as PDF

Points: 7 (partial)
Time limit: 1.0s
Memory limit: 256M

Author:
Problem types

James, being the egirl he is, likes to set quirky and cool messages as his Discord status!

James has a new Discord status he wants to use for a single contiguous (possibly empty) range of days within the next days. He knows that using his new status on the day will net him egirl points and that days for which he does not use his new status will not affect his egirl points. Note that may be negative.

Furthermore, because James is quirky and cool, the number of days for which the new status is applied must be a multiple of a given positive integer .

Find the maximum number of egirl points James can gain within the next days from using his new status!

#### Input Specification

The first line contains two integers, and .

The next line contains integers, the values of .

#### Output Specification

Output a single integer, the maximum number of egirl points James can gain by using his new Discord status on a contiguous subsequence of the next days, where the number of days for which the status is applied is a multiple of .

#### Sample Input 1

5 2
1 3 2 -4 3

#### Sample Output 1

5

#### Explanation for Sample 1

James uses his new Discord status on days and , netting egirl points.

#### Sample Input 2

4 3
1 2 -69 8

#### Sample Output 2

0

#### Explanation for Sample 2

James chooses not to apply his new Discord status at all, netting egirl points.