Constrain sum of elements in an array

In reply to dave_59:

In reply to muneebullashariff:
Can you think of a solution that should have worked?

Hi Dave,

Element’s value can be as follows :
8,8,16,8 ; sum being 40

Thank you,

Regards,
Muneeb