You are given a 2D array representing K sorted arrays. Your task is to merge them into a single sorted array. (Note: this is identical in implementation to the External Sorting simulation problem).