#include
#include
using namespace std;
int main()
{
int tests;
cin>>tests;
for(int tno=0;tno<tests;tno++)
{
int n,k,e,m;
int score;
int ser[50],sertot=0,total[50]={0},temp=0;
cin>>n>>k>>e>>m;
for(int i=0;i<n-1;i++)
{
for(int j=0;j<e;j++)
{
cin>>score;
total[i]=total[i]+score;
}
}
for(int j=0;j<e-1;j++)
{
cin>>ser[j];
sertot+=ser[j];
}
sort(total,total+n-1,greater<int>());
temp=total[k-1];
if(temp >= sertot)
{
int need;
need=temp-sertot;
if(need<=m)
cout<<need+1;
else
cout<<"impossible";
}
else
{
cout<<"0";
}
}
return 0;
}