#include <bits/stdc++.h>
#include <queue>
using namespace std;
long long a[505],b[505],n,m;
struct node{
int first,second;
};
queue <int> q;
bool vis[505];
void bfs(){
while(q.size()){
int p = q.top();
//long long time = q.top().second;
q.pop();
for (int i = 1; i <= n; i++){
if (!vis[i] && ceil((a[i]-a[p])*1.0 / (b[p]-b[i])) >= time){
}
}
}
}
int main(){
int t;
cin >> t;
while(t--){
cin >> n >> m;
for (int i = 1; i <= n; i++) cin >> a[i];
for (int i = 1; i <= n; i++) cin >> b[i];
for (int i = 1; i <= n; i++) vis[i] = 0;
q.push(m);
vis[m] = 1;
bfs();
}
}