Subset sum problem java. If there exists no such subset then print -1 instead.