function vars = allnxtseq(vars,m)

p = length(vars);

for vc=p:-1:1
    if vars(vc) < m
        vars(vc) = vars(vc)+1;
        vars(vc+1:p) = vars(vc);
        break;
    else
        if vc == 1
            vars = ones(1,p+1);
        end;
    end;
end;

if p==0
    vars = 1;
end;

