The format should be... if (! (x in array))
It's not just the whole 'if' that needs to be in parentheses (), but also the "x in array", i.e. (x in array) so that awk applies the not (!) to the (x in array) boolean result and not to just x. Perhaps the 'in' operator should have higher precedence than '!'.