It seems that it's not possible to find contacts who are in group A, but not in group B. The only place where it's possible to exclude a group is Search Builder, but when I give two criteria (contact is in group A) and (contact is not n group B) CiviCRM ignores the second clause.
I tried to convert the second clause to use a Tag. So I've created a tag for group B, and searched for contacts in group A and contacts not in tag B.
The result is really puzzling, and it seems I am not following CiviCRM's logic:
(this is polish l10n, but "Etykieta" and "Kategorie" are both translations for "Tag") Could someone clarify, what is happening here?