Sharp keys: Think of C major as the first one, then think of starting a new scale on the 5th note this scale (i.e G) this gives you the next key and (if you look at a piano keyboard) you will see you need to sharpen the 7th note (i.e. F) to keep it the major scale pattern.
The 'sharp' key that comes after C maj is therefore G major, with one sharp (F).
Repeat this process and you get D major, (2 sharps), repeat it again (A major, 3 sharps), and again (E major, 4 sharps), again (B major 5 sharps), again (F# major, 6 sharps). If you feel enthusiastic do it again (C# major, 7 sharps)
Flat keys: same idea but this time you are going down a 5th every time so the first key is F. You'll also find you have to flatten the 4th note (

to keep the major scale pattern.
The 'flat' key that comes after C major is therefore Fmajor withy one falt note (

.
Go down another 5th and you come to Bflat major with 2 flats (E and

, again (E flat, 3 flats ), again (A flat, 4 flats), and again (D flat, 5 flats).
At this point you realise that you've come to the same point as in the 'sharp keys' above 'cos D flat is the enharmonic equivalent of C #. If you feel enthusiastic you can carry on to Gflat, which is the enharmonic of F#.
If you keep this sytem in mind it doesn't matter if you forget everything, you can work any key siganture in just a few minutes with a pencil and a piece of scrap paper. Try it - just write them out in a column.
The order in which the notes are sharpened is:
Fish Can Go Down And Eat Bait (which I like 'cos I'm a keen fisherman)
They are flattened in the reverse order:
British Eurpean Airways Do Good Cheap Flights (this may not be so good 'cos BEA hasn't existed for years).
Hope this helps!