Under construction

Still being built. Things may change

Dance

Interview

Time limit2sMemory limit1024 MB

Summary
Given the heights of 2N students, decide whether they can be split into N pairs where each pair's height difference is at most D.
Level

Easy3 of 10

Topics
Sorting, Greedy
Solved
No attempts yet

Problem

A class at JOI Junior High School has 2N students. The height of student ii is A1, A2, …, A2N.

In Thursday's physical education class, the students form N pairs of two people each to dance.

The class wants to pair the students so that the dance is beautiful. For the dance to be beautiful, the height difference within every pair must be at most D.

Given the height of each student, write a program that determines whether a beautiful dance is possible.

Input

The input is given in the following format.

N D
A1 A2 … A2N

Output

If a beautiful dance is possible, print Yes. Otherwise, print No on one line.

Constraints

  • 1≤N≤1001 \leq N \leq 100.
  • 0≤D≤1000 \leq D \leq 100.
  • 1≤Ai≤1001 \leq A_i \leq 100 (1≤i≤2N1 \leq i \leq 2N).
  • All input values are integers.

Examples3

  1. Example 1

    Input
    1 5
    2 7
    
    Expected output
    Yes
    
  2. Example 2

    Input
    3 0
    10 10 10 11 10 10
    
    Expected output
    No
    
  3. Example 3

    Input
    6 4
    22 15 32 36 16 30 42 30 39 23 17 18
    
    Expected output
    Yes