In Maine cultivation of marijuana with less than 5 plants is a Class E misdemeanor
with a maximum of 6 months in jail. It's possible that if the rightful owner came forward charges against you might be dropped. But it will also depend on the circumstances.
If, for example, the marijuana was being grown on the premises where you and this other person lived, and you both had access to the area where the marijuana was being grown, you could get charged under a theory of constructive possession, even if someone else was doing all the tending of the plants. Also, if this other person were to speak to a lawyer before owning up to his involvement here, he would be told to keep his mouth shut and not to incriminate himself by confessing to a crime for which he isn't a suspect.
So there's no way of giving you a time frame. If the other person comes forward right away and the prosecutor believes that you knew nothing about this and is willing to drop the charges, they will dismiss charges against you, probably on your first court
date. If he believes that you and the other person were both involved in the cultivation together, all that will occur is that he will get charged and your case will continue on unchanged.