Discovery of block on blockchain is confusing me

1M Ago
The term discovery is what’s confusing me the absolute most. By discovery it seems they just mean make it from scratch from the mempool. And then they put it out there for people to solve for the special puzzle thing. But since the minors can put any transactions they want into this block want all of them be different but also want some of them include similar transactions. Mempool: Transaction one, transaction two, transaction three, transaction four, transaction 5. Ex. Miner A - transaction 1 , transaction two, transaction three, transaction five Miner B- transaction 2, transaction three transaction four, transaction five These two miners have some of the same transactions but the other transactions are different. So if miner A gets his block solved 1st what happens to miner B? What if miner B solves his right after. They both had transactions 2 and 5 on the block. I think I’m getting lost with the logistics of it within the terminology too. Anyone try to explain in detail how a blocked discovery actually works.