The proof of this is simple classical application of the inclusion/exclusion principle.
Count the number of functions that leave at least one out of the image.
How functions leave one member out: .
How functions leave two members out: .
But now you have counted some twice. So substract.
Etc