You could add a dublicate counter.
Once out find a pair, let j increase until numbers[j] != numbers[j+1] and count how many duplicates you encounter. Add this number to pairs everytime you find one. Once you increase j set the duplicate counter back to one.
Shouldn't the time constraint be around O(n²) for the sorted approach, as you are iterating through the sorted array in a nested loop, resulting in (N - K)/2 *N lookups of pairs? Or am I missing something?