%Original Approach
b=0;
min1 = 1;
max1 = 1;
pair = [];
for n = -min1:max1
for m = -min1:max1
if n+m == b
pair = [pair;n,m];
end
end
end
pair
%Vectorized approach
[n,m] = meshgrid(-min1:max1)
idx = n+m==b
out = [n(idx) m(idx)]