A mass m starting from A reaches B of a frictionless track. On reaching B