# Identifying finite-index subgroups of $SL_2(\mathbb Z)$ from generators

Suppose I have a finite set of elements of the modular group $\operatorname{SL}_2(\mathbf{Z})$. Is there a finite procedure that will determine whether or not the group they generate has finite index, and if so, calculate this index?

Similarly, if the group they generate does have finite index, is there a finite procedure to determine whether some $g \in \operatorname{SL}_2(\mathbf{Z})$ lies in this group?

(Note: This question has been reposted at MathOverflow.)

-