Let $K=\mathbb R$ and let $a_i\in\mathbb R$ be infinitely many distinct points indexed by positive integers. Then the union of these points is not algebraic in $A^1$ because every ideal in the polynomial ring is principal and hence every algebraic set is finite.