K-shell ionization of atoms and ions by relativistic projectiles