Given an array of integers nums and an integer k, return the total number of subarrays whose sum equals k.
A subarray is a contiguous non-empty sequence of elements within an array.
Note: nums can contain negative numbers, so a plain sliding window does not work.