Enter array of nums:


Create a new array taking the first and last elements from a given array of integers and length must be greater or equal to 1.