import heapq

def k_smallest_pairs(nums1, nums2, k):
    if not nums1 or not nums2 or k <= 0:
        return []

    n1, n2 = len(nums1), len(nums2)
    heap = []
    limit = min(n1, k)

    for i in range(limit):
        heapq.heappush(heap, (nums1[i] + nums2[0], i, 0))

    result = []
    while heap and len(result) < k:
        _, i, j = heapq.heappop(heap)
        result.append([nums1[i], nums2[j]])
        if j + 1 < n2:
            heapq.heappush(heap, (nums1[i] + nums2[j + 1], i, j + 1))

    return result