The present invention provides selective 5-HT7 receptor antagonist compounds of Formula I and their use in the treatment of migraine, persistent pain, and anxiety: where A and B are each independently —C(H)═ or —N═, provided that at least one of A and B is —N═, n is 1-3, m is 0-3, and R1-4 are as defined herein.