Device-to-Device Communications Underlaying a Cellular Network