C++ Easy solution
I used set of vectors to count distinct arrays.\n\nclass Solution {\npublic:\n    \n    int countDistinct(vector<int>& nums, int & k, int & p) {\n        int n=
I used set of vectors to count distinct arrays.\n```\nclass Solution {\npublic:\n    \n    int countDistinct(vector<int>& nums, int & k, int & p) {\n        int n=nums.size();\n        set<vector<int>> s;\n        for (int i=0; i <n; i++){\n            vector<int> v;\n            int c=0;\n            for (int j=i; j<n; j++){\n                if(nums[j]%p==0) c++;\n                v.push_back(nums[j]);\n                if(c>k){break;}\n                if(c<=k){s.insert(v);}\n            }\n        }\n        \n        \n        return s.size();\n    }\n};\n```\n\n**upvote if you learnt from this post**
['C', 'Ordered Set']