You can make a 66x1 pixel "swatch" of the 66 colours you want by taking one of your original PNG images and extracting the unique colours like this:
magick original.png -unique-colors swatch.png
Then you can apply it like this:
magick unhappy.jpg -remap swatch.png result.png
More details here.
Here's a concrete example. Here's our map:

First, make a swatch of the 5 colours we want to appear in our output image:
magick xc:"rgb(10,100,140)" xc:"rgb(240,190,120)" xc:"rgb(70,130,30)" xc:"rgb(220,230,230)" xc:"rgb(40,80,50)" +append swatch.png

Now remap all the colours in the original to the 5 colours in the swatch:
magick map.jpg +dither -remap swatch.png result.png

Alternatively, we could let ImageMagick choose the best colours for the swatch like this:
magick map.jpg -colors 7 -unique-colors swatch.png

And remap just the same as before but using the colours ImageMagick chose:
magick map.jpg +dither -remap swatch.png result.png

Note that you can use hex codes (or HSL, or Lab colours) just the same:
convert xc:"#0a658c" xc:"#f0be78" xc:"#46821e" xc:"#dce6e6" xc:"#285032" +append swatch.png
Note that the above commands assume ImageMagick v7. If you are obliged to use old v6 syntax, replace magick with convert.