These are called aborts.

Not all the fruits (yes, mushrooms are called fruits) have success in life.

Some are just not to make it until maturity and they die out before dropping their spores (see image)

Mushroom aborts are not growing and stay small and shrivled

These are pinheads that start to grow and then suddenly they just stop growing. Aborts are just as good to eat as normal mushrooms and they might even be a little stronger but they must be picked before they begin to decompose.
A mushroom that has mold growing on it or which has black goo in the center of the stem is rotten and is not safe to eat. It is often difficult for beginners to identify an aborted mushroom before it begins to decompose. Early warning signs include a halt in growth of the mushroom, and a greenish tinge around the dark colored tip of the primordia that will eventually become the cap of the mushroom. Always completely remove aborts from the cake, even if they are too rotten to eat because they can get moldy and cause the cake to get infected.

The easiest way to spot them is when you see that the mushrooms stopped growing for about 4 or 5 days. At this point it is time to decide that they have to be picked.