Optimizing the K-out-of-N Rule for Cooperative Spectrum Sensing in Cognitive Radio Networks