Constraint qualifications and optimality conditions for optimization problems with cardinality constraints