#include<bits/stdc++.h>
typedef long long int ll;
typedef unsigned long long int ull;
#define BIG_NUM 2000000000
#define HUGE_NUM 1000000000000000000
#define MOD 1000000007
#define EPS 0.000000001
using namespace std;



int main(){

	int N,K;
	scanf("%d %d",&N,&K);

	if(N%K == 0){

		printf("0\n");

	}else{

		printf("1\n");
	}

	return 0;
}

#include<bits/stdc++.h>
using namespace std;

int main()
{
	int a, b;
	cin >> a >> b;
	cout << min(1, a % b) << "\n";
	 
	return 0;
}