I think it's B) because a missing modifier is when a sentence is broke apart incorrectly and I don't think that B) is correctly separated. I could rearrange the sentence and make it say, "The thunder frightened me as I slept peacefully" and it would sound better. I hope I helped a bit.