a,b=map(int,input().split()) c=[0 for i in range(b)] for i in range(a): d,e=map(int,input().split()) if c[d-1]