LearnPy Hub
← Arena
IntermediateRating 1200

Flip k Signs

Exactly k times, choose any number and change its sign (the same number can be chosen again). Make the sum as large as possible and print it.

Input

n and k, then n integers.

Output

One integer.

Sample 1

Input
3 1
4 2 3
Output
5

Sample 2

Input
4 3
3 -1 0 2
Output
6
solution.py
Output appears here
Flip k Signs · Python Arena problem · LearnPy Hub