I've done something similar in my script. There's no need for a separate function, you can just write
Sum -= l.pop(0)
So that the accumulator that counts the sum of the elements in your sequence is reduced be it's first element.
Another thing. You are probably using a counter in this exercise to consider where your function is. When you do the .pop or delete the first element in any other way, you obviously have to modify that counter. Otherwise your function will skip an element (If you need an example to understand better let me know). So this becomes:
Acc -= 1
Last thing. If you still have some problems with your script it may be because it gets to the end, but the condition you have put into the while statement doesn't get false. A solution, though not much elegant, is to append a value bigger than the number bigger than the subtotal.
Let me know if this answer was useful and, if it was, pin it as the best. Thank you!