from bisect import bisect_right from math import sqrt def calc_distance_2d(coord1: tuple[int, int], coord2: tuple[int, int]) -> float: return sqrt((coord1[0]-coord2[0])**2 + (coord1[1]-coord2[1])**2) def main(): N, K = map(int, input().split()) H = list(map(int, input().split())) coords = [tuple(map(int, input().split())) for _ in range(N)] shrines = list(zip(H, coords)) shrines.sort() shrines_coord = [coord for _, coord in shrines] shrines_year = [hist for hist, _ in shrines] ctr = N for shrine_hist, shrine_coord in shrines: old_idx = bisect_right(shrines_year, shrine_hist) for other_coord in shrines_coord[old_idx:]: if calc_distance_2d(shrine_coord, other_coord) <= K: ctr -= 1 break print(ctr) if __name__ == "__main__": main()