------
## 最终结论
```python
# Read the number of test cases
T = int(input())

# Initialize a list to store the test cases
test_cases = []

for _ in range(T):
    # For each test case, read n and k
    n, k = map(int, input().split())
    # Read the array a
    a = list(map(int, input().split()))
    # Append the test case as a tuple (n, k, a)
    test_cases.append((n, k, a))

# Initialize a list to store the maximum number of casts for each test case
max_casts = []

for n, k, a in test_cases:
    # Initialize the counter for the number of casts for the current test case
    count = 0
    
    # Sort the array a in non-decreasing order
    a.sort()
    
    # Iterate through each pile and try to copy candies to other piles
    for i in range(1, n):
        # Get the current pile's candy count (smallest first)
        current_candies = a[0]
        
        # Try to add current_candies to pile i
        max_addable = (k - a[i]) // current_candies  # Maximum times we can add current_candies to pile i
        if max_addable > 0:
            count += max_addable  # Update the count with how many times we can perform this operation
            
            # Update pile i's candy count since we are effectively performing these operations
            a[i] += max_addable * current_candies
    
    # Append the result for this test case to max_casts list
    max_casts.append(count)

# Output the results for each test case
for result in max_casts:
    print(result)
```