Narrow-band search for gravitational waves from known pulsars using the second LIGO observing run