------
## 最终结论
```python
def subarraySum(nums, k):
    count = 0
    cumulative_sum = 0
    sum_count = {0: 1}  # Initialize with sum 0 occurring once

    for num in nums:
        cumulative_sum += num  # Update the cumulative sum
        
        if cumulative_sum - k in sum_count:  # Check if there exists a subarray sum equals to k
            count += sum_count[cumulative_sum - k]  # Increase count by the number of times (cumulative_sum - k) has occurred
        
        # Update the count of the current cumulative sum in the dictionary
        if cumulative_sum in sum_count:
            sum_count[cumulative_sum] += 1
        else:
            sum_count[cumulative_sum] = 1

    return count  # Return the count of subarrays whose sum equals to k
```