Given two arrays nums1 (subset) and nums2, for each x in nums1, find the next greater element to its right in nums2. Return -1 if none exists.
This problem demonstrates the monotonic stack pattern: scan once, maintain a decreasing stack of indices, and resolve each element's next-greater as a bigger value arrives.
Example: nums1 = [4,1,2], nums2 = [1,3,4,2] → [-1, 3, -1].
[-1,3,-1]