Set the two models equal and collect the exponentials on one side.
1000(1.05)t=1500(1.02)t⟹(1.021.05)t=1.5
The ratio of factors is itself a growth factor, about 1.029412, so take logarithms.
t=log1.029412log1.5≈0.0125890.176091≈14.0 years
Town A always catches up eventually: its larger factor beats any head start, given enough time.