Nonlocality as a consequence of complementarity