[C++]✅ || Easy Solution 🚀|| Prefix sum & Hashmap☀️
\nclass Solution {\npublic:\n    int minSubarray(vector<int>& nums, int p) \n    {\n        long long sum = 0;\n        for (auto x: nums)   sum += x;\n        
```\nclass Solution {\npublic:\n    int minSubarray(vector<int>& nums, int p) \n    {\n        long long sum = 0;\n        for (auto x: nums)   sum += x;\n        if (sum % p == 0)   return 0;\n        \n        int tarRem = sum % p;\n        long long  preSum = 0;\n        unordered_map<int, int>mp;\n        mp[0] = -1;\n        int ans = INT_MAX;\n        \n        for (int i=0;i<nums.size();i++)\n        {\n            preSum += nums[i];\n            int currRem = preSum % p;\n            int reqRem = (currRem - tarRem + p) % p; //for handling negative elements:\n            \n            if (mp.find(reqRem) != mp.end())\n            {\n                ans = min(ans, i - mp[reqRem]);\n                mp[currRem] = i;\n            }\n            else   mp[currRem] = i;\n        }\n        \n        return (ans == INT_MAX || ans == nums.size()) ? -1 : ans;\n    }\n};\n```
['C++']