Swap the two ballasts, if the problem follows the ballast, then you need to change that, if the problem stays on the same bulb, then you need to change the bulb.
That said, faulty ballasts can damage bulbs too, so you may even need to replace both.
If you see red/brown residues inside the bulb itself (along with a more yellow/red light colour), that's a sign of a damaged bulb that won't last long.
I've heard stories of people putting damaged (but still functioning) HID bulbs in the same ultrasound baths that you use to clean injectors and that seems to get them back to shape. I haven't tried it so I can't tell you if it's true or not, but it might be worth a try if you can get someone to do the ultrasound bath for cheap.
Also, another good idea is to give the ballast a dedicated ground wire directly connected to the chassis, rather than using the stock ground wire that was used for the original halogens, some cars don't like the kind of current flowing through some HIDs and can fuck up some unrelated stuff.
On my car, for example, I replaced a faulty ballasts with a new one. The previous worked perfectly for 5 years with stock wirings, but as soon as I plugged the new one, my wipers started going crazy and they eventually stopped working.
After a bit of research I found out my wiper motor shares the ground with the RHS headlight and a lot of people with the same car reported the same problem after putting HIDs on, so the solution was to give the bulb a dedicated, separate ground wire to fix the problem and avoid more burned motors.