Help me in solving ARRAYSTATE problem

My issue

I removed all list methods in my program and write an alternative code without using list methods just because it showing time limit exceeded.But still its only showing time exceeded. I dont understand why :[

My code

# cook your dish here
t=int(input())

for i in range(t):
    
    n,k=map(int,input().split())
    l=list(map(int,input().split()))
    
   for j in range(k):
        
        d=l[0]+l[-1]
        l=l[1:n]
        
        l[-1]=d
        n=n-1
       
        
    
    print(*l)


Problem Link: Find Multiset State Practice Coding Problem