$$\require{cancel}$$
Outside the sphere, the field and the potential are just as if all the mass were concentrated at a point in the centre. The potential, then, outside the sphere, is just $$−GM/r$$. Inside the sphere, the field is zero and therefore the potential is uniform and is equal to the potential at the surface, which is $$−GM/a$$. The reader should draw a graph of the potential as a function of distance from centre of the sphere. There is a discontinuity in the slope of the potential (and hence in the field) at the surface.