“te vas a quedar como el perro de las dos tortas” is a common idiom in spain, it's used as a warning and literally translates to "You're going to end up like a dog with two cakes", now I had to dig deep for that one, and appearantly it originates to one of Aesop's fables (A greek fubalist who lived in the 6th century BC), and it talks about a dog who is carrying a piece of meat in his mouth, as he walks by a river, and sees his reflection in the water, assuming it's another dog who also has a piece of meat, he gets greedy and demands that one too, but ends up losing both of them as they flow with the tide...
The moral of the story is not to be greedy, thus the idiom means "you're going to lose everything if you're never satisfied with what you have"