Constraining Gluon Distributions in Nuclei Using Dijets in Proton-Proton and Proton-Lead Collisions at sqrt[s_NN]=5.02  TeV