LearnPy Hub
← Arena
IntermediateRating 1400

Hands of Straights

Can the cards be split into groups of exactly w cards, where each group is w consecutive values? Print YES or NO.

Input

n and w, then n card values.

Output

YES or NO.

Sample 1

Input
9 3
1 2 3 6 2 3 4 7 8
Output
YES

Sample 2

Input
5 4
1 2 3 4 5
Output
NO
solution.py
Output appears here
Hands of Straights · Python Arena problem · LearnPy Hub