max $1^\top x$ such that $x^\top M x = 0$ and $x_i^2 = x_i$ for all i

For the above problem how can I derive the dual form. My main problem is to choose matrix notation or the element-wise notation as I am deriving the dual. This conflict is cause by the constraint $x_i^2 = x_i$.

Would you describe the solution or at lest some tips to dwell into the derivation?