Here's a little more help if you want it...
When saving a .gif in GIMP you're best to use the built in optimization function first, to see if that reduces the file size as much as you need.
To do this go Filters> Animation>optimize for GIF
GIMP will apply the settings it believes is necessary to make your GIF as small as possible without sacrificing too much quality. However, GIMP makes these determinations for you. The output will be another document, a copy of the first, but optimized, then save this optimized document as you would normally save any .gif.
With the save for web plugin you are allowed a little more control over the balance between quality and file size. When using the save for web plugin you have to select .gif out of the available image options and it ought to save as an animation with your desired settings.
Lastly, this particular animation, is just too long to be compressed to 40kB with any usable result. There is simply too much information to cram into a package that small while still ensuring it looks good.
Let me show you:
When I tell photoshop to compress this animation to be no larger than 40kB it has to reduce the frames to 2 colors, and the result is this:
The file size here is 40kB, but obviously 2 colors isn't going to do, so when I increase the colors to an acceptable amount, this is the result:
However this animation is still a sizable 396kB. A far cry from 40kB. It should also be known that to reach this outcome, I had to delete about 30 extraneous frames, so this animation is running 121 frames, rather than the 154 frames your original .gif had and still I can only reasonably compress it to about 400kB.
When this is the problem, I can really only suggest two things:
1) Keep reducing frames. Get rid of absolutely every frame you can afford to lose.
2) Reduce the size of the canvas. If you're making this for an icon, resize the animation piece to something smaller than 100x100, such as 70x70 and then place the animation on a background canvas of 100x100.
Here is an example of that:
Here the animation is reduced to 70x70, resulting in a file size of 180kB.
Here it has been reduced to about 50x50 and the file size is 92kB.