Leases - Operating Lease Cost and Additional Lease Information (Details) - USD ($) $ in Thousands |
3 Months Ended | 9 Months Ended | |||
|---|---|---|---|---|---|
Feb. 29, 2024 |
Feb. 28, 2023 |
Feb. 29, 2024 |
Feb. 28, 2023 |
May 31, 2023 |
|
| Leases [Abstract] | |||||
| Operating lease costs | $ 21,000 | $ 19,800 | $ 61,500 | $ 59,300 | |
| Other information related to operating leases | |||||
| Cash paid for amounts included in the measurement of operating lease liabilities | 38,577 | 37,103 | |||
| Operating lease right-of-use assets obtained in exchange for new and renewed operating lease liabilities | 41,506 | 42,900 | |||
| Operating lease right-of-use assets acquired in business combinations | $ 334 | $ 0 | |||
| Weighted-average remaining lease term | 5 years 3 months 18 days | 5 years 3 months 18 days | 5 years 3 months 10 days | ||
| Weighted-average discount rate | 3.38% | 3.38% | 2.87% | ||