Java | Brute Force
\npublic int countDistinct(int[] nums, int k, int p) {\n        HashSet<List<Integer>> set = new HashSet<>();\n        for(int i=0; i<nums.length; i++){\n      
```\npublic int countDistinct(int[] nums, int k, int p) {\n        HashSet<List<Integer>> set = new HashSet<>();\n        for(int i=0; i<nums.length; i++){\n            int count  = 0;\n            List<Integer> temp = new ArrayList<>();\n            for(int j=i; j<nums.length; j++){\n                if(count>=k && nums[j]%p==0)\n                    break;\n                if(nums[j]%p==0){\n                    count++;\n                }\n                temp.add(nums[j]);\n                List<Integer> temp2 = new ArrayList<>(temp);\n                set.add(temp2);\n            }\n        }\n        return set.size();\n```
[]