Qalipakka algoritmi tunngasunik erfimassalluni ilinniartoq katersorneq kusanik katsorsuutigalugu nuna tamakkerluni nuna tamaat
a = [-2, 1, -3, 4, -1, 2, 1, -5, 4], k = 3
1. Aapileri pillsussaagut `a`-mi, tummarissut, `k`-mi, subarray-i size.
2. `max_sum`-i nittartagaq, subarray-i sumaaq, naggataaffiini -inf, `window_sum`-i nittartagaq, window-i (subarray-i) sumaaq, `a`-i k inissisarfik sumaa.
3. `a`-i k index-mit peqatigiinnarlugit for loop-imut, `window_sum`-i update, window-i piffissat illit nassat, window-i inutit ajugaat.
4. `max_sum`-i update, `max_sum`-i, `window_sum`-i nalunaat.
5. Iteratsiuni illuat, `max_sum`-i terug, subarray-i size `k` sumaaq. 

```python
def max_sum(a, k):
    max_sum = float('-inf')
    window_sum = sum(a[:k])
    
    for i in range(k, len(a)):
        window_sum = window_sum - a[i - k] + a[i]
        max_sum = max(max_sum, window_sum)
        
    return max_sum

a = [-2, 1, -3, 4, -1, 2, 1, -5, 4]
k = 3
result = max_sum(a, k)
print(f"Maximum sum of subarray of size {k}: {result}")
```