Relationship Between Coronal Mass Ejections and Flares