Ideals of finitely generated commutative monoids