#K47502. Unique Bottle Distribution

    ID: 28212 Type: Default 1000ms 256MiB

Unique Bottle Distribution

Unique Bottle Distribution

You are given a batch of bottles, where each bottle is described by two integers: the number of pills and a serial number. There are exactly m pharmacies, and each pharmacy must receive exactly one bottle. The constraint is that no two bottles given to the pharmacies can have the same serial number.

Mathematically, if the bottles are represented as tuples ((p, s)), where (p) is the number of pills and (s) is the serial number, the distribution is valid if and only if (|\text{bottles}| = m) and all serial numbers (s) are distinct.

Determine whether it is possible to distribute the bottles to the pharmacies according to these conditions.

inputFormat

The first line contains two integers (n) and (m), denoting the total number of bottles and the number of pharmacies, respectively. Each of the next (n) lines contains two integers representing the number of pills and the serial number of a bottle.

outputFormat

Output a single line: "YES" if it is possible to distribute exactly one bottle to each pharmacy while ensuring all bottles have unique serial numbers; otherwise, output "NO".## sample

5 3
10 1001
20 1002
15 1003
18 1004
25 1002
NO