------
## 最终结论
```python
def findPoisonedDuration(timeSeries, duration):
    if not timeSeries:
        return 0
    
    total_poisoned_time = 0
    
    for i in range(len(timeSeries) - 1):
        total_poisoned_time += min(timeSeries[i+1] - timeSeries[i], duration)
    
    total_poisoned_time += duration
    
    return total_poisoned_time

# Example usage:
print(findPoisonedDuration([1, 4], 2)) # Output: 4
print(findPoisonedDuration([1, 2], 2)) # Output: 3
```