Type II and anomalous Cepheids in the Kepler K2 mission