Let us first understand what is happening in the problem. A particle moves along some arbitrary path (shown by the dotted line - imagine a roller coaster ride for example). It moves in such a way that its horizontal acceleration is always fixed and equal to a. In other words if the the particle is moving along a direction
then, the acceleration of the particle along the direction of its motion (along the tangential direction) is given by
(the component of a along the tangential direction).If the particle moves an infinitesimally small distance along the curved path ds, the distance it moves forward along the x-axis dx is given by,

This is clearly shown in the figure.
If the tangential velocity of the particle at any instant is given by
, then we have,