Nonlinear energy sink applied to an oscillator under principal and subharmonic external resonances