What is the trick for knowing the name of a key signature with flats?
The next to last flat is the name of the key.

A semitone above the flat furthest to the right is the name of the key.

The next to last sharp is the name of the key.

A semitone above the sharp furthest to the right is the name of the key.