Basic property of boolean functions with restrictions
This is Corollary 3.22 of Analysis of Boolean Functions, by Ryan O'Donnell (2014). You may want to consult the proof in the book, or look directly at the online version (which has a different numbering: this corresponds to Corollary 22 there).

Note that you can obtain a version of the book following this link.