import java.util.*;

public class Main {
    static final long INF = (long)4e18;

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        int T = sc.nextInt();

        while (T-- > 0) {

            int N = sc.nextInt();
            long K = sc.nextLong();

            long[] X = new long[N];
            long[] S = new long[N];

            for (int i = 0; i < N; i++)
                X[i] = sc.nextLong();

            for (int i = 0; i < N; i++)
                S[i] = sc.nextLong();

            long[] need = new long[N];
            need[N - 1] = INF;

            for (int i = N - 2; i >= 0; i--) {

                if (S[i] <= S[i + 1]) {
                    need[i] = need[i + 1];
                } else {

                    long gap = X[i + 1] - X[i] - 1;
                    long diff = S[i] - S[i + 1];

                    long t = (gap + diff - 1) / diff + 1;

                    need[i] = Math.min(t, need[i + 1]);
                }
            }

            int ans = 0;

            for (int i = 0; i < N; i++)
                if (need[i] <= K)
                    ans++;

            System.out.println(ans);
        }
    }
}