Need help to understand why my solution is not working
\npublic int minSubarray(int[] nums, int p) {\n        long sum = 0L;\n        \n        for (int i : nums) {\n            sum += i;\n        }\n        \n     
```\npublic int minSubarray(int[] nums, int p) {\n        long sum = 0L;\n        \n        for (int i : nums) {\n            sum += i;\n        }\n        \n        // no need to remove any element\n        if (sum % p == 0) return 0;\n\t\t\n        // otherwise in order to make array divisable by p we need to remove subarray who sum is\n        // mod = sum%p. For example, nums = [3,1,4,2], p = 6 totalSum in this case would be 10. \n\t\t// To make the array divisble by 10 we will remove subArray who\'s sum is 4 = 10%6\n        int mod = (int) sum%p;\n        \n        int start = 0, res = nums.length;\n        sum = 0;\n        for (int end=0; end<nums.length; end++) {\n            sum += nums[end];\n            \n            while (start < end && sum > mod) {\n                sum -= nums[start++];\n            }\n            \n            if (sum == mod) {\n                res = Math.min(res, end-start+1);\n            }\n        }\n        \n        return res == nums.length  ? -1 : res;\n    }\n```\n\nAbove solution is working for basic test cases\n```\n[3,1,4,2]\n6\n[6,3,5,2]\n9\n[6,5,2,3]\n9\n[5,2,6,3]\n9\n[1,2,3]\n3\n[1,2,3]\n7\n[1000000000,1000000000,1000000000]\n3\n```\n\nBut is failing for \n```\n[26,19,11,14,18,4,7,1,30,23,19,8,10,6,26,3]\n26\n```\n\nNot able to understand why we need to do something like this https://leetcode.com/problems/make-sum-divisible-by-p/discuss/854197/JavaC%2B%2BPython-Prefix-Sum or what\'s is missing in my solution\n\nThank you in advance!!
[]