Nonlinear energy sink to control primary and subharmonic resonances of a Duffing oscillator