from collections import Counter
class Solution(object):
    def subarraySum(self, nums, k):
        """
        :type nums: List[int]
        :type k: int
        :rtype: int
        """
        if len(nums)==0:
            return 0
        number,temp=0,0
        count=Counter()
        count[0]=1
        for num in nums:
            temp = temp + num
            number+=count[temp-k]
            count[temp]+=1
        return number
nums=[1,1]
k=0
s=Solution()
print(s.subarraySum(nums,k))