过点(3,1)作圆(x-1)^2+y^2=5相切,且与直线ax-y+1=0垂直,则a=