#include <bits/stdc++.h>
#define endl '\n'

using namespace std;

typedef long long lld;

void solve(){
    int n;
    lld c, ans=1e18, days=0, money=0;
    cin>>n>>c;
    lld a[n], b[n-1];
    for(int i=0;i<n;i++)cin>>a[i];
    for(int i=0;i<n-1;i++)cin>>b[i];
    for(int i=0;i<n;i++){
    	if(money>=c){
    		ans=min(days,ans);
    	}
    	else ans=min(ans,days+(c-money+a[i]-1)/a[i]);
    	if(i<n-1){
    		if(money>=b[i]){
    			money-=b[i];
    			days++;
    		}
    		else{
    			lld k=(b[i]-money+a[i]-1)/a[i];
    			days+=k+1;
    			money+=k*a[i];
    			money-=b[i];
    		}
    	}
    }
    if(ans==1e18)cout<<-1<<endl;
    else cout<<ans<<endl;
}

int32_t main(){
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int t;cin>>t;while(t--)solve();
    return 0;
}