------
## 最终结论
```python
def coinChange(coins, amount):
    # Initialize the dp array with infinity for all values except dp[0] = 0
    dp = [float('inf')] * (amount + 1)
    dp[0] = 0
    
    # Fill the dp array
    for i in range(1, amount + 1):
        for coin in coins:
            if coin <= i:
                dp[i] = min(dp[i], dp[i - coin] + 1)

    # Check if we can form the amount and return the result
    return dp[amount] if dp[amount] != float('inf') else -1
```