Either way, 205/40 will be thinner.
205 is the section width, which is how wide the tread is measured in millimeters.
40 is the series, which is how tall the sidewall is measured as a percentage of the section width.
A 205/40 tire has a sidewall height of approximately 82 millimeters, a 215/40 tire has a sidewall height of approximately 86 millimeters.