Specialization of Néron-Severi groups of K3 surfaces