We are usually grateful for good things that happened to us—but with a little imagination, we can also be grateful for bad things we avoided.