This study will look at the effects of CagriSema on cardiovascular events (for example heart attack and stroke) in people living with cardiovascular disease. Participants will either get CagriSema or a dummy medicine (also called "placebo") which has no effect on the body. Which treatment participants will get will be decided by chance. Participant's chance of getting CagriSema or placebo is the same. Participants will inject the study medicine once a week. The study medicine will be injected briefly with a thin needle, typically in the stomach, thighs or upper arms. The study will last for up to 4.5 years.