An adaptive pruning algorithm for the discrete L-curve criterion