N,K = map(int,input().split()) H = list(map(int,input().split())) XY = [list(map(int, input().split())) for _ in range(N)] HXY = [] for h,(x,y) in zip(H,XY): HXY.append([h,x,y]) HXY = sorted(HXY, key=lambda x: x[0]) ans = N for i in range(N): th,tx,ty = HXY[i] for j in range(i+1,N): h,x,y = HXY[j] if th