Consider the worst case scenario. We have 6 each of different colours(but note that there are only 5 red ones).
Therefore pick $5(red)+6(green)+6(blue)+6(yellow)=23$.
Now adding one more marble ensures that we have at least 7 of the same colour (By pigeonhole principle).
Threrefore, $\mathbf{23+1=24 }$
Option (D)