Help me in solving PAPY0210 problem

My issue

output is partially correct

My code

# cook your dish here
for i in range(int(input())):
    n,m=map(int,input().split())
    l=list(map(int,input().split()))
    for i in range(m):
        l.remove(max(l))
        l.remove(min(l))
        n-=2
    s=sum(l)/n
    s=str(s)
    a=s.find(".")
    s1=s[:a+1]
    print(s1,end="")
    s2=s[a+1:]
    z=len(s2)
    while z<6:
        s2+="0"
        z+=1
    print(s2)
    

Learning course: Python with Data structures
Problem Link: Coding problem Practice Problem in Python with Data structures - CodeChef