key signature is the set of sharps (#) or flats (b) that is written at the beginning of a piece of music to
indicate the key of the piece.
These sharps or flats are located in front of a clef,
either a bass or a treble clef.
The Order of Flats:
BEADGCF
The Order of Sharps:
FCGDAEB
As you can see, it's just reversed for each. A good way to remember which way is which is that the symbol for a flat (b) looks like a B, and the order begins with a B.
Keys:
To name a flat key, you count the number of flats, and the next to the last flat names the key.
For example, if there are 3 flats on the staff, they are B, E, and A. So it's an E flat.
To name a sharp key, you count the number of sharps, and then take the next alphabetical letter up.
For example, if you have 4 sharps, they'd be F, C, G, D. So it would be E.