Cardinality-Aware Set Prediction and Top-$k$ Classification