I am getting run time error(NZEC) , don't know why? what is wrong with my code? Problem Code: ENTEXAM

import sys
import math
import string

t=int(input())
while t>0:
    n,k,e,m=list(map(int,input().strip().split(" ")))
    i=1
    tm=[]
    while i<=n-1:
        l=list(map(int,input().strip().split(" ")))
        tm.append(sum(l))
        i=i+1
    l=list(map(int,input().strip().split(" ")))
    tm.sort(reverse=True)
    
    if sum(l)>tm[k-1]:
        print("0")
    else:
        if tm[k-1]-sum(l)+1>m:
            print("Impossible")
        else:
            print(tm[k-1]-sum(l)+1)
    t=t-1