Demand doesnt allocate resources... price and expected economic profit does.
Thats literally how the whole economic system functions.