This is a play on words. The word "smart" means feeling a sharp, stinging pain but "smart" also means having a strong intelligence. The joke is that if the ointment make's the subject's arm smart, they should put the ointment on their head so their brain gets smarter.
Doctor , Doctor , this ointment you gave me makes my arm smart . . - Then rub some on your head ? Next .