M-type stars exhibit more diverse spectral lines than O-type stars primarily due to their lower temperatures, which allow for more bound electrons, leading to a crowded spectrum. The variety of elements in M-type stars can be attributed to their formation from gas clouds enriched by older stars and supernovae, influencing their composition. Additionally, the evolutionary processes of stars, including the transition from main sequence to red giant phases, contribute to this diversity. The convective nature of cooler stars creates dynamic conditions that further enhance spectral line variety. Overall, the complexity of stellar evolution and the physical conditions in M-type stars result in their richer spectral characteristics.