import sys

rm = lambda: list(map(int, sys.stdin.buffer.readline().split()))



n, k = rm()

print((0 if n%k == 0 else 1))

import sys

rm = lambda: list(map(int, sys.stdin.readline().split()))



n, k = rm()

print((0 if n%k == 0 else 1))

import sys

rm = lambda: list(map(int, sys.stdin.buffer.readline().split()))
n, k = rm()
print((0 if n % k == 0 else 1))

import sys

rm = lambda: list(map(int, sys.stdin.readline().split()))
n, k = rm()
print((0 if n % k == 0 else 1))

-rm = lambda: list(map(int, sys.stdin.buffer.readline().split())) +rm = lambda: list(map(int, sys.stdin.readline().split()))