public int countAlarms(int[] volume, int S) {
        int count = 0;
        while (true) {
            if (S <= 0) {
                break;
            }
            for (int i = 0; i < volume.length; i++) {
                S -= volume[i];
                count++;
                if (S <= 0) {
                    break;
                }
            }

        }
        return count;
    }