list1=[1,2,3,2,4,2,3,1]
list2=[1,2,3,2,4,2,3,1]
dic={}
s=[]
for x,y in enumerate(list1):
list2.remove(y)
if y in list2:
for m,n in enumerate(list1):
if n==y:
s.append(m)
else:
continue
dic[y]=s
s=[]
print(dic)