I don't think this is an either/or situation.
I'd affirm Hegal's idea that reality is made up of ideas, but suggest the word "perceptions" to be more specific.
The fault in the statement "Material existance shapes our ideas" is the assumptions we have access to some sort of objective "material existance";
we only have our perceptions of "objective reality". (Note this is not suggesting that it doesn't exist, it just doesn't exist) However, Marx is
correct to point out the impacts the exterior reality might have on the way a person is predisposed to perceive it.

