If U is an open subset of R^m then is open in D. So if U, V are open and disjoint, and covers the range of f, then , are disjoint open sets whose union is D. You take it from there... .

Similar idea. If you have a covering of the range of f by open sets, then their inverse images form an open cover of D, which has a finite subcover... .