public Iterable<Key> kSmallest(int k){
    	if (k < 0 || k > N)
    		return null;
        /* TODO: Implement kSmallest here... */
    	Queue<Key> kSmallestKeys = new Queue<Key>();
    	MaxHeap<Key> heap = new MaxHeap<Key>(k);
    	int index = 0;
    	int keyCount = 0;
    	while (keyCount < k && index < M)
    	{
    		if (keys[index] != null)
    		{
    			heap.insert(keys[index]);
    			keyCount++;
    		}
    		index++;
    	}
    	Key max = heap.returnMax();
    	while (index < M)
    	{
    		if (keys[index] != null)
    		{
    			if (max.compareTo(keys[index]) > 0)
    			{
    				heap.delMax();
    				heap.insert(keys[index]);
    			}
    		}
    		index++;
    	}
    	for (int i = 0; i < k; i++)
    	{
    		kSmallestKeys.enqueue(heap.delMax());
    	}
    	
    	return kSmallestKeys;
    }