I really need help!

I currently have a spreadsheet that is laid out with two blocks of text like so:

Brick Bat Bear Pen Compass
Red Blue Yellow Fish Hen
Pig Pig Bear Fish Brick
Compass Bat Pen Fish Brick


Horse Bear Red Blue Dog

I want to find the number of UNIQUE values in the first, big block of text that MATCH with the second small block of text. That is to say, if for instance "Red" matches with the block above 2 times, I want it to count once. If "Horse" matches 0 times, I want it to count as zero.

I've tried everything! How would I set this function up?