Change Derailleur on CX Bike
You can't just get a derailleur and cassette to make this work the way you want. The components are designed as part of a system with parts that are designed to work together, at least according to SRAM.

You will want a rear derailleur that matches your SRAM Red shift levers.
According to page 2 of this chart:
You can get gearing of 11-32 or 12-32 with a range of front chain ring sizes if you use the mid length arm of the SRAM Red 22 rear derailleur. This would be a derailleur and cassette purchase (I'm assuming your bike came with a short arm rear derailleur) that would get you closer to your goal, but not all the way.

To get to 11-40 or 11-42 and have all the parts match you'd have to go with a different parts group.
According to page 3 of the chart linked above the Force 1 or Rival 1 shifter, long cage derailleur and cassette will go to 42.
You'll also need a longer chain.