------
## 最终结论
```python
import heapq

def kthSmallest(matrix, k):
    n = len(matrix)  # 行数
    m = len(matrix[0]) if n > 0 else 0  # 列数
    
    min_heap = []
    
    for r in range(min(n, k)):  # Only need to consider the first k rows
        heapq.heappush(min_heap, (matrix[r][0], r, 0))  # (value, row_index, col_index)
    
    count = 0
    while count < k:
        value, r, c = heapq.heappop(min_heap)  # Extract the smallest value from the heap
        count += 1  # Increment the count of extracted elements
        
        if count == k:  # If we've extracted k elements, return the current value
            return value
        
        if c + 1 < m:  # If there is a next column in the same row, add that to the heap
            heapq.heappush(min_heap, (matrix[r][c + 1], r, c + 1))
```