A grocery store has small bags of apples for 5$ and large bags of apples for 8$. If you buy 6 bags of apples and spend 45$, how many of each bags did you buy?