#include <bits/stdc++.h>
using namespace std;
 
int main() {
  int n,k;cin>>n>>k;
  int ans = 0; if (n%k > 0) ans++;
  cout << ans << endl;
}

#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (n); i++)
using ll = long long;
using P = pair<int,int>;
const long long inf = 1000000001; // const 書き換え禁止
const double PI = 3.14159265358979323846; //M_PI はライブラリ

int main(void){
    int n,k;
    cin >> n >> k;
    if(n%k == 0){
        cout << 0 << endl;
    }else{
        cout << 1 << endl;
    }
    
}