Resource Allocation for D2D Communication Systems