public class Solution {

public int subarraySum(int[] nums, int k) {

```
int M=0;
int count=0;
int len=nums.length;
while(M<len){
int N=M;
int sum=0;
while(N<len){
sum+=nums[N];
if(sum==k){
count++;
}
N++;
}
M++;
}
return count;
}
```

}