After a vacuum failure in a tokamak, plasma runaway or plasma disruptions frequently occur during plasma recovery, causing difficulties in rebuilding a well-confined collisional plasma. In this work, the impurity behavior during plasma recovery after a vacuum failure in the 2019 spring campaign of the Experimental Advanced Superconducting Tokamak (EAST) was studied by analyzing the spectra recorded by fast-time-response extreme ultraviolet (EUV) spectrometers with 5 ms/frame. During the plasma current ramp-up in recovery discharges, a high content of the low-Z impurities of oxygen and carbon was found, i.e., dozens of times higher than that of normal discharges, which may have caused the subsequent runaway discharges. The electron temperature in the recovery discharge may have dropped to less than 75 eV when the collisional plasma quenched to the runaway status, based on the observable impurity ions in the two cases. Therefore, the lifetime of collisional plasma in the recovery discharge, τc, was deduced from the lifetime of H- and He-like oxygen and carbon ions identified from EUV spectra. It was found that, after several discharges with real-time lithium granule injection, the runaway electron flux and O+ influx reduced to 45% and 20%, respectively. Meanwhile, the lifetime of confined plasma was extended from 113 ms to 588 ms, indicating the effective suppression of impurities and runaway electrons and improvement in plasma performance by real-time lithium granule injection. The results in this work provide valuable references for the achievement of first plasma in future superconducting fusion devices such as ITER and CFETR.