Wavefront shaping is a powerful technique that can be used to focus light through scattering media, which can be important for imaging through scattering samples such as tissue. The method is based on the assumption that the field at the output of the medium is a linear superposition of the modes traveling through different paths in the medium. However, when the scattering medium also exhibits nonlinearity, as may occur in multiphoton microscopy, this assumption is violated and the applicability of wavefront shaping becomes unclear. Here we show, using a simple model system with a scattering layer followed by a nonlinear layer, that with adaptive optimization of the wavefront light can still be controlled and focused through a scattering medium in the presence of nonlinearity. Notably, we find that moderate positive nonlinearity can serve to significantly increase the focused fraction of power, whereas negative nonlinearity reduces it. arXiv:1607.08105v2 [physics.optics]