Dielectron yields in p+d and p+p collisions at 4.9 GeV