Please solve the programming task below using a self-contained code snippet in a markdown code block.

Given an integer array nums and an integer k, modify the array in the following way:

choose an index i and replace nums[i] with -nums[i].

You should apply this process exactly k times. You may choose the same index i multiple times.
Return the largest possible sum of the array after modifying it in this way.
 
Please complete the following python code precisely:
```python
class Solution:
    def largestSumAfterKNegations(self, nums: List[int], k: int) -> int:
```