Easy Python Solution
Explanation\n1. Loop twice \n2. For each subarry, check if the number of elements divisble is less than or equal to \'k\'.\n3. If greated than given \'k\' then 
Explanation\n1. Loop twice \n2. For each subarry, check if the number of elements divisble is less than or equal to \'k\'.\n3. If greated than given \'k\' then break the inner loop. Else add the current substring to set().add(nums[i:j+1] )\n4. Convert each subarray to string and add it to Set() to easily maintain/discard duplicates.\n\n\n```\nclass Solution:\n    def countDistinct(self, nums: List[int], k: int, p: int) -> int:\n        n = len(nums)\n        res = set()\n\n        for i in range(n):\n            k1 = 0\n            for j in range(i, n):\n                if nums[j] % p == 0:\n                        k1 += 1\n                if k1 <= k:\n                    res.add(str(nums[i:j+1]))\n                else:\n                    break\n\n        return len(res)\n```\n\ntime: O(n\\*\\*2)\nspace: O(n)\n
['Python']