It's more complicated than I realized! From learngaelic.scot: In Gaelic the definite article an is used in the following circumstances: -before feminine words beginning with a vowel. -before masculine nouns beginning with the three consonants c, g and s -before masculine and feminine nouns beginning with the consonants d, l, n, r and t. -before feminine nouns beginning with the letter s apart from those beginning with sl, sn, sr, or s+ vowel (see below for information on these nouns.) -before feminine nouns beginning with the letter f followed by a vowel. A word like this requires the letter h to be inserted before the vowel when using the definite article. Take faoileag (a seagull), for example. It becomes an fhaoileag.
In Gaelic the definite article am is used in front of masculine words beginning with the consonants b, f, m and p.
Not sure why this is being downvoted. I thought it might have been asked and answered already in another post, but I've had a look and can't find one. I know it's to do with the gender of the noun, and possibly what letter the noun begins with.
I found this post though which has a good comment on it. Hope it helps! :-) https://forum.duolingo.com/comment/35424439