G Major
When working with flats, the second to last flat is the key signature. The exception here being when only one flat is in the key signature - this would be the key of 'F.' The order of flats are as follows: B-flat, E-flat, A-flat, D-flat, G-flat... etc.
The key signature indicates which notes are sharp, natural, or flat. Every key has a specific signature.
It comes before the time signature. The clef comes before the key signature.
D major has a key signature of F sharp and C sharp D minor has a key signature of B flat
There are no sharps or flats in the key signature of C Major.