Close equal numbers

Given an integer number kk and nn numbers x1,xnx_1, \dots x_n, are there at least two equal numbers at distance at most kk? Consider the sequence of xix_i’s circularly, that is, assume that x1x_1 is to the right of xnx_n.

Input

Input consists of several cases, each with kk and nn, followed by x1,xnx_1, \dots x_n. You can assume 1kn/21 \le k \le n/2, 2n1052 \le n \le 10^5, and that each xix_i is an integer number between 0 and 10910^9.

Output

For every case, print “yes” if there is at least a pair of xix_i’s with the required condition, and print “no” otherwise.

Problem information

Author: Javier Nistal

Generation: 2026-01-25T11:16:33.182Z

© Jutge.org, 2006–2026.
https://jutge.org