Measurement of high-mass dimuon production for p+p and p+d collisions with 120 GeV proton beam at Fermilab