For a pair of FMs, you will need a MINIMUM of a 20 long or 29 gallon tank and that is really pushing it. I'd go with at least a 40 long to a 55 gallon for them.
so, #1: If you can, get a bigger tank. If you can't, return the fish to a fish store and start over with some fish better suited to your tank (there aren't many since it's so small)
#2: In the mean time, if you can't do either of those things right away, do a water change. If the fish have been in the tank a while, they have probably gotten use to the dirty water, so you should start off with small water changes of around 1 gallon and do those a couple times a day to slowly bring down the ammonia level. Also, don't feed them for a while until the ammonia is under control. That will only make the water worse