An exact Bianchi-type II cosmological model with matter and an electromagnetic field