The sentence is:
All the children of my class agreed not to learn poetry by heart just to avoid an / the unpleasant process.
I can rewrite dividing it into two sentences. Article "a" is obvious here:
All the children of my class agreed not to learn poetry by heart. We all know that learning is a difficult process.
But should I use article "the" in the single sentence because process has already been mentioned as learning?