a=eval(input()) m=eval(input()) b=[] d=[] for c in range(1,a+1): b.append(c) if c%m!=0: d.append(c) print(b) print(d)