a,b=map(int,input().split()) c=list(map(int,input().split())) strawberry=[[] for i in range(a)] for i in range(a-1): for j in range(i+1,a): if c[i]==c[j]: strawberry[i].append(j) strawberry[j].append(i) print(strawberry)