Nonlinear terahertz metamaterials