Maximal subgroups of finite groups avoiding the elements of a generating set