This question evaluates algorithmic problem-solving and data-structure competencies, focusing on frequency counting, multi-criteria tie-breaking (smaller numeric value then earlier first-occurrence), and performance considerations for very large arrays.

Given an integer array nums and an integer k, return the k values with highest frequency. If multiple values share the same frequency, break ties by (