O(n*m) not fast enough for BIG n, using heap to get ~O(m log n)