/*
	Author: Uday Gupta
*/

#include<bits/stdc++.h> 
using namespace std;
#pragma warning(disable : 4996)
#include<unordered_map>

//----------define start----------//
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define endl "\n"
typedef long long ll;
#define int ll
#define sz(x) ((int)x.size())
#define rep(i, n)    for(int i = 0; i < (n); ++i)
#define repA(i, a, n)  for(int i = a; i <= (n); ++i)
#define repD(i, a, n)  for(int i = a; i >= (n); --i)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define fill(a)  memset(a, 0, sizeof (a))
//----------define end----------//

//----------const start----------//
const int N = 2e5 + 5;
const int mod = 1e9 + 7;
const ll inf = 1e18;
//----------const end----------//

//----------typedef start----------//
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int, int> pii;
typedef vector<int> vi;
//----------typedef end----------//


//----------global variables start----------//
//int n;
//string s;
//vector<int> a(N);
//vector<vector<int>> memo_table(N, vector<int>(4));
//----------global variables end----------//
ll po(ll x, ll y, ll p = mod) { ll res = 1; x %= p; while (y > 0) { if (y & 1)res = (res * x) % p; y = y >> 1; x = (x * x) % p; }return res; }
ll inv(ll x, ll p = mod) { return po(x, p - 2); }


void solve()
{
	int n, c;
	cin >> n >> c;

	vi a(n + 1),b(n+1);
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	for (int i = 1; i < n; i++) {
		cin >> b[i];
	}

	int ans = inf;
	int m = 0;
	int prevd = 0;
	for (int i = 1; i <= n; i++) {
		if (c > m) {
			int days = (c - m) / a[i];
			if ((c - m) % a[i] != 0) {
				days++;
			}
			days += prevd;
			ans = min(ans, days);
		}
		else {
			ans = min(ans, prevd+1);
		}

		if (i != n) {
			if (b[i] > m) {
				int days2 = (b[i] - m) / a[i];
				if ((b[i] - m) % a[i] != 0) {
					days2++;
				}
				m += days2 * a[i];
				m -= b[i];
				prevd += days2 +1;
			}
			else {
				prevd++;
				m -= b[i];
			}
		}

	}
	cout << ans;

}

signed main()
{

	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(0);

#ifndef ONLINE_JUDGE 
	freopen("input.txt", "r", stdin);
	freopen("error.txt", "w", stderr);
	freopen("output.txt", "w", stdout);
#endif


	int t = 0;
	int test_cases = 1;
	cin >> test_cases;
	//cout << fixed << setprecision(6);
	while (t++ < test_cases)
	{
		//cout << "Case #" << t << ": ";
		solve();
		cout << "\n";
	}

	cerr << "time taken : " << (float)clock() / CLOCKS_PER_SEC << " secs" << endl;

	return 0;
}
