Curves with a triple point on a $K3$ surface