ans to store unique subarrays.i as the start index and j as the end index of the current subarray.i, initialize an empty list tt to represent the current subarray and a counter ct to count elements divisible by p.j, add nums[j] to tt and increment ct if nums[j] is divisible by p.ct exceeds k, break the inner loop as we cannot include more elements divisible by p.tt to the set ans.ans as the number of distinct subarrays.