Radio Resource Allocation for Device-to-Device Communications Underlaying Cellular Networks