Jut realised I didn't actually understand the answer given.
It's just a really basic use of the chain rule of differentiation. Chain rule - Wikipedia, the free encyclopedia
The second term is being treated as a composite function u = (1 - p) and so the -1 is just the differential of (1 - p).
Disgustingly simple.