Irreducible polynomials and affine variety

No need to consider $f,g$ irreducible polynomials, it's enough to assume $\gcd(f,g)=1$. Then $\gcd(f,g)=1$ in $K(X)[Y]$, and therefore there exist $u,v\in K(X)[Y]$ such that $1=uf+vg$. In order to clear the denominators we can find a polynomial $w\in K[X]$ such that $wu,wv\in K[X,Y]$. From $w=(wu)f+(wv)g$ it's obvious that $f(a,b)=g(a,b)=0$ implies $w(a)=0$ and since $w$ has only finitely many roots in $K$ we are done.