/*
#include <algorithm>
#include <iostream>
#include <vector>
#include <string>
#include <queue>
#include <deque>
#include <tuple>

#include <unordered_set>
#include <unordered_map>
#include <set> // lower_bound : <= ; upper_bound : > ; *s.upper_bound(x) de type X
#include <map> // lower_bound : <= ; upper_bound : > ; *m.upper_bound(x) de type pair<X, Y>
#include <stdio.h>
*/

#include <bits/stdc++.h>
#include <numeric>

using namespace std;


#define hmap unordered_map 
#define hset unordered_set 

#define print_var(x) cout << #x << " is " << x << endl;

template<typename T, typename Compare> 
using heap = priority_queue<T, vector<T>, Compare>;

int days_for(int val, int gain){
	if (val <= 0)
		return 0;
	return (val/gain)+(val%gain > 0 ? 1 : 0);
}

int main(){
	ios::sync_with_stdio(false);
	cin.tie(0);

	int t; cin >> t; 

	for (int steps=0; steps<t; steps++){
		int n, c; cin >> n >> c; 
		vector<int> b(n-1);
		vector<int> a(n);
		for (int i(0); i<n; i++)
			cin >> a[i];
		for (int i(0); i<n-1; i++)
			cin >> b[i];

		auto compare = [](tuple<int, int, int> a, tuple<int, int, int> b){ // days, place, money
			return get<0>(a) > get<0>(b);
		};
		heap<tuple<int, int, int>, decltype(compare)> Q(compare);
		Q.push(make_tuple(0, 0, 0));

		while (Q.size() > 0){
			int days, place, money;
			tie(days, place, money) = Q.top();
			Q.pop();
			if (money >= c){
				cout << days << endl;
				break;
			}

			

			if (place < n-1)
				Q.push(make_tuple(days+days_for(b[place]-money, a[place])+1, place+1, money-b[place]+days_for(b[place]-money, a[place])*a[place]));
			Q.push(make_tuple(days+days_for(c-money, a[place]), place, c+1));

		}

	}
	

}


