N, K = map(int, input().split())

if N == 1:
    print("YES" if K >= 0 else "NO")
else:
    found = False
    # Iterate possible m values (number of multiplies)
    for m in range(0, K + 1):
        pow2 = 1 << m
        if pow2 > N:
            break
        residual = N - pow2
        if residual < 0:
            continue
        if residual % 3 != 0:
            continue
        sum_terms = residual // 3
        current = sum_terms
        sum_a = 0
        # Compute minimal sum_a
        for i in range(m + 1):
            exponent = m - i
            coeff = 1 << exponent
            ai = current // coeff
            sum_a += ai
            current %= coeff
            if current == 0:
                break
        if sum_a + m <= K:
            found = True
            break
    print("YES" if found else "NO")