The interplay between affective and cognitive factors in shaping early proficiency in mathematics