#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
typedef long long int ll;
typedef unsigned long long int ull;
const int MAXN = 2e5+10;
const int mod = 1000000007;

void solve(){
	ll n, c;
	cin>>n>>c;
	vector<ll> aec(n), bec(n, 0);
	for(int i=0 ; i<n ; i++)cin>>aec[i];
	for(int i=0 ; i<n-1 ; i++)cin>>bec[i];
	ll su = 0;
	ll ans = 1e18, pre = 0, carry = 0;
	for(int i=0 ; i<n ; i++){
		ans = min(ans, pre + (ll)ceil(double(c-carry)/aec[i]));
		ll now = max(0ll, (ll)ceil(double(bec[i]-carry)/aec[i]));
		pre+=(now+1);
		// pre+=(max(1ll, ceil(double(bec[i]-carry)/aec[i])+1));
		carry += (aec[i]*now - bec[i]);
	}
	cout<<ans<<"\n";
    return;
}


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



