#include<bits/stdc++.h>

# define ll long long
# define fr first
# define sc second
# define pb push_back
# define pob pop_back
# define pf push_front
# define pof pop_front

const ll N = 1e6 + 10;
const ll INF = 1e18;
const ll inf = -1e18;
const ll MOD = 1e7 + 7;

using namespace std;

ll n, c, p, k, s, a[N], b[N], ans;

void solve()
{
    p = k = s = 0;
    cin >> n >> c;
    for(int i = 1;i <= n;i++)
        cin >> a[i];
    for(int i = 1;i < n;i++)
        cin >> b[i];
    ans = (c + a[1] - 1) / a[1];
    for(int i = 2;i <= n;i++) {
        s = b[i - 1] - p;
        k++;
        k = k + (s + a[i - 1] - 1) / a[i - 1];
        p = (s + a[i - 1] - 1) / a[i - 1] * a[i - 1] - s;
        ans = min(ans, k + (c - p + a[i] - 1) / a[i]);
    }
    cout << ans << "\n";
}

int main()
{
    ios_base::sync_with_stdio(0);
    ll o = 1;
    cin >> o;
    while(o--)
    {
        solve();
    }
}
//2 2 0 2 1 0
//10
