Resonant interaction of smooth pulses with two-level atoms