Hundreds of thousands of dollars in debt, and no residency. That’s the situation for 412 medical school graduates this year in the United States.

A residency — paid, on-the-job training — is an essential step in becoming a medical doctor. In some cases, students’ failure to obtain a residency has nothing to do with their performance, but rather with the supply and demand of the system that allocates them, the National Resident Match Program.

It also has to do with simple math. The National Resident Match Program’s annual report, released in May, shows 26,678 positions. For the second year in a row, the number of graduates exceeded the number of residencies available.

Medicare funds those residencies, costing $10 billion a year. Congress set this allocation in 1997, and it has remained unchanged since then.

But not for lack of trying. In 2013, lawmakers introduced two bills, the Resident Physician Shortage Reduction Act and the Training Tomorrow’s Doctors Today Act. Neither bill passed the House of Representatives.

Janis Orlowski, the senior director in health care affairs for the Association of American Medical Colleges, said Congress needs to increase funding to prevent a catastrophic shortage of doctors.

“We’ve gotten to a choke point where there are more students graduating than are getting a residency,” Orlowski said.

This residency shortage comes at a time when demand for doctors is increasing, she said. An aging population, an increase in the pool of insured people due to the Affordable Care Act, and the fact that almost a third of all physicians are expected to retire in the next decade all contribute to the rising need for new doctors. Her organization, interpreting U.S. Census data, predicts a shortage of 130,000 physicians by 2025.

Orlowski said that when she was in medical school during the 1980s, the country faced a similar physician shortage, which led to a federal investment in building and expanding medical schools.

This time around, medical schools have increased class sizes in response to the shortage, which is a good start, she said. But without an increase in the number of residency positions, the number of doctors cannot increase — no matter how many people graduate from medical school.

Currently, students select and rank desired residencies through the National Resident Match Program, which uses an algorithm to meet the needs of both the students and hospitals. For the unlucky ones who don’t get a match, it’s often just a matter of too many applicants for certain specialties.

This year — Match Day was March 31 — the number of unmatched graduates decreased to 412 from last year’s 528, which Orlowski attributes in part to students’ increased willingness to apply for primary care positions.

“Some primary care residencies did not fill in the past, and they did now, which is good,” Orlowski said. “Rather than everyone wanting to be a dermatologist — a very lucrative but hard-to-fill spot — people selected wisely, especially in competitive areas.”

James E. Wilberger, a neurosurgeon and vice president for graduate medical education at Allegheny Health System, said that unless something is done, the residency shortage will continue to get worse.

“Right now the number is small, but the trend is disturbing,” he said.

Wilberger said he knew one graduate who failed to get a residency this year. Describing the graduate as a “top-notch student,” an aspiring orthopedic surgeon with “excellent credentials,” he said there is sometimes no predicting which students will fail to match.

Officials at University of Pittsburgh Medical School would not comment on whether they had any unmatched graduates.

But Alexis Chidi, a Pitt medical student who also is seeking a Ph.D., said she was aware of at least two Pitt medical school seniors who had failed to get a residency in the past two years. Chidi said that each student’s choice of specialty and his or her desired locale both may have played a role.

“Everybody goes into medical school wanting to have unlimited choice of specialty and geographic areas,” she said. “But depending upon a number of factors, including performance in medical school or what school you go to, might affect your ability to match into a program.”

There is a process in place, known among medical students as “the scramble,” which gives students who didn’t match one last opportunity to get a residency without having to wait another year. But Chidi said that some specialties don’t have many opportunities available during the scramble, leaving some students out of luck.

(EDITORS: STORY CAN END HERE)

At the West Virginia School of Osteopathic Medicine, Ross Knowles is a third-year medical student who hopes to become a surgeon. He said that until more residencies open up, some aspiring physicians may not be able to pursue their areas of interest.

Knowles, who would prefer to work in a small town or rural setting, said he was worried that he would take a less-than-ideal residency out of necessity.

“The problem is that we’re going to have people with the aptitude and the passion to work in a certain field or certain region, and they’re not going to be able to do it because there aren’t enough spots,” Knowles said.

Everette James, the director of the University of Pittsburgh’s Health Policy Institute, said that addressing the doctor shortage will require more than simply upping Medicare funding.

“We’re certainly going to need more primary care physicians,” James said. “Simultaneously, we’re going to need to expand the use of advance practice providers.”

James listed nurse practitioners, physicians’ assistants, physical therapists, pharmacists and others as playing key roles in future delivery of health care.

“These are going to be some tough changes for all of us, but we can certainly look at federal and state deficits and realize we can’t continue to pay health services at the rate of increase we’ve been paying,” James said. “We must develop new cost-effective models of health care delivery.”

Meanwhile, those graduates without residencies must wait until next year to apply again — while managing to pay or defer student loans. What they’re doing in the meantime is somewhat of a mystery. Although a failure to get a residency isn’t usually the student’s fault, the stigma associated is likely keeping those students from speaking out.

“Medical students are used to being at the top of their game,” Chidi said. “It’s difficult to get to medical school throughout their educational career. So for some medical students, it’s the first time they haven’t gotten what they wanted.”

Wilberger said that some unmatched graduates may work in pharmaceuticals or other fields not directly related to medicine. He said that at West Penn, students are allowed to spend an extra year in medical school, working in a lab. Since they haven’t technically graduated, they don’t have to begin paying student loans.

Orlowski said that some students do a year of research or take a fellowship.

“The average debt (of medical school graduates) is between $150,000 and $200,000,” Orlowski said. “They can’t be licensed. I just couldn’t imagine (going through that).”

Send questions/comments to the editors.