#C10740. Checkpoint Passing

    ID: 39979 Type: Default 1000ms 256MiB

Checkpoint Passing

Checkpoint Passing

A citizen is required to pass through n checkpoints. At each checkpoint, the citizen carries a certain number of high-value items. The citizen is allowed to carry at most k high-value items at any checkpoint.

You are given the number of checkpoints n, the maximum allowed items k, and a list of n integers representing the number of high-value items at each checkpoint. Determine whether the citizen can pass through all checkpoints without exceeding the limit.

In mathematical terms, given a list of items \(a_1, a_2, \dots, a_n\), if \(a_i \leq k\) for all \(i\) then the answer is "YES"; otherwise, it is "NO".

inputFormat

The input is read from standard input (stdin) and consists of two lines:

  1. The first line contains two space-separated integers: (n) (the number of checkpoints) and (k) (the maximum allowed number of high-value items per checkpoint).
  2. The second line contains (n) space-separated integers, where each integer represents the number of high-value items at a checkpoint.

outputFormat

Print a single string to standard output (stdout): "YES" if the citizen can pass through all checkpoints without carrying more than (k) items at any checkpoint, otherwise print "NO".## sample

5 3
1 2 3 4 2
NO