The simple interest is given by:

where P is the principal (the amount we invest in the account), r is the interest rate and t is the time of investment.
Let P be the interest Larry made in the 2% account, the simple interest in this case is given by:

Now for the second account we would have an envestment of (17000-P), then the simple interest have to be:

and we know that both investments have to be equal to 610, then we have:

Therefore Larry invested $8000 in the 2% account and $9000 in the 5% account.