Let
x----------> number of blue marbles
y----------> number of red marbles
we know that
3x=2y+18----------> y=(3x-18)/2------> equation 1
and
5x=6y-2-----------> y=(5x+2)/6----------> equation 2
(1)=(2)
(3x-18)/2=(5x+2)/6----> 3*(3x-18)=5x+2
9x-54=5x+2
9x-5x=2+54-------> 4x=56---------> x=14
y=(3x-18)/2-------> y=(3*14-18)/2=24/2-------> y=12
the answer is
14 blue marbles
12 red marbles