#K56392. Division with GCD One

    ID: 30188 Type: Default 1000ms 256MiB

Division with GCD One

Division with GCD One

You are given two integers \( N \) and \( K \). Your task is to determine if it is possible to divide the number \( N \) into \( K \) non-negative integers such that the greatest common divisor (GCD) of all these integers is 1.

The problem can be summarized by considering the following conditions:

  • If \( K > N \), it is impossible to divide \( N \) among \( K \) parts.
  • If \( K = 1 \), the answer is always "YES".
  • If both \( N \) and \( K \) are even, then every way of splitting \( N \) into \( K \) parts will yield numbers that are all even, hence their GCD will be at least 2. In this case, the answer is "NO".
  • In all other cases, it is possible to achieve a division with GCD equal to 1 and the answer is "YES".

Formally, if we denote the parts by \( a_1, a_2, \dots, a_K \) such that \( a_1 + a_2 + \dots + a_K = N \) and \( a_i \ge 0 \), determine whether there exists a distribution for which \( \gcd(a_1, a_2, \dots, a_K) = 1 \).

inputFormat

The input is given via stdin and consists of a single line containing two space-separated integers \( N \) and \( K \).

outputFormat

Output via stdout a single line containing either "YES" if it is possible to divide \( N \) into \( K \) non-negative integers with a GCD of 1, or "NO" otherwise.

## sample
5 2
YES

</p>