Given that one of the values of $x$ satisfying the quadratic equation $x^2-(2a+1)x+(a^2+2)=0$ is twice the other, find $a$.