Resource Allocation Optimisation for Vehicle-to-Everything Communications Underlaying Cellular Networks