Paying up Algorithm and WA

I am getting WA

after reading the problem i decomposed the problem into

Given a set of integers, and a value sum(mobster demand), determine if there is a subset of the given set with sum equal to given sum.

Is my decomposition of problem is right??

If yes i applied this algo

where it is going wrong

My code

http://www.codechef.com/viewsolution/5841974

please help