A year before Boston Medical Center reported its first loss in five years, the hospital paid Chief Executive Elaine Ullian $3.5 million in deferred compensation on top of her $1.35 million salary and benefits, according to a recent filing with the Massachusetts attorney general's office. Ullian, who announced her resignation when her contract ends in January, received the additional compensation last year, a time when the hospital reported $56 million in profitable earnings. But the hospital has said it expects to lose $38 million by the end of this fiscal year and projects it will lose an additional $175 million next fiscal year, which begins on Oct. 1, an 18% operating loss.