There is a sequence of positive numbers \(a_1,a_2,a_3,\dots,a_m\) such that \(a_1=19,a_2=98,\) and \(a_m=0\) and
\(a_{n+2}=a_n-\frac{2}{a_n+1},\) for \(n=1,2,\dots,m-2\).
Find the value of \(m\).
m = 498.