Medicare Part B helps cover medical services like doctors’ services, outpatient care, and other medical services that Part A doesn’t cover. Part B is optional. Part B helps pay for covered medical services and items when they are medically necessary. Part B also covers some preventive services like exams, lab tests, and screening shots to help prevent, find, or manage a medical problem.
https://www.hhs.gov/answers/medicare-and-medicaid/what-is-medicare-part-b/index.html

