The 500 Problem

Here’s a subtraction problem. The numbers a and b stand for digits. If the two subtraction sums give the same answer, what digits do a and b stand for?

500 5ab
-ab5 -500