easy JAVA solution 100%faster
```\nclass Solution {\n    public int minElements(int[] nums, int limit, int goal) {\n        long totalsum=0L;\n        for(int i=0;i0 && remain>0){\n         
```\nclass Solution {\n    public int minElements(int[] nums, int limit, int goal) {\n        long totalsum=0L;\n        for(int i=0;i<nums.length;i++){\n            totalsum+=nums[i];\n        }\n        if(totalsum==goal){\n            return 0;\n        }\n        long count=0L;\n        long remain=Math.abs(totalsum-(long)goal);\n        if(remain<limit)return 1;\n        while(limit>0 && remain>0){\n            \n                 if(remain>limit){\n                 count+=remain/limit;\n                 remain=remain%limit;\n                 \n                      }else{\n                count++;\n                break;\n            }\n                      }\n            \n        return (int)count;\n    }\n}
['Java']