#include <bits/stdc++.h>
using namespace std;
#define _USE_MATH_DEFINES
#define ios std::ios::sync_with_stdio(false);cin.tie(NULL)
#define ll long long int
#define PI acos(-1.0)
#define EPS 1e-9 //epsilon 10^-9, checking for equality 
#define pb push_back
#define fi first
#define se second
#define go(i,a,n) for(int i=a;i<n;i++)
#define og(i,a,n) for(int i=n-1;i>=a;i--)
#define rep(i,n) go(i,0,n)
#define per(i,n) og(i,0,n)
#define sz(x) (x.size())
#define isort(x) sort(x.begin(),x.end())
#define dsort(x) sort(x.rbegin(),x.rend())
#define all(x) x.begin(),x.end()
#define rall(x) (x).rbegin(),(x).rend()
#define pr(x) cout<<(x)<<endl
#define exist(e,s) ((s).find(e)!=(s).end()) //Element e in structure s
#define existstr(c,s) ((s).find(c) !=string::npos) //Character in structure
#define fo(x,s) for(auto &x:s) //for all x in structure s
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector< vector<int> > vvi;
typedef vector< vector<ll> > vvll;
typedef pair<int,int> ii;
typedef pair<int, pair<int,int> > iii;
typedef pair<ll,ll> pll;
typedef vector<ii> vii;
typedef vector<iii> viii;
const int inf=1e9+7; //10^9 +7
void solve();
//Many functions are taken from geeksforgeeks and other websites
inline void rvi(vi& v, int n){int temp; go(i,0,n){cin>>temp;v.pb(temp);}}
inline void rvll(vll& v, int n){ll temp;go(i,0,n){cin>>temp;v.pb(temp);}}
inline void prvi(vi&a){go(i,0,a.size()){cout<<a[i]<<" ";}cout<<endl;}
inline void prvll(vll&a){go(i,0,a.size()){cout<<a[i]<<" ";}cout<<endl;}
inline void prmii(map<int,int>& m){for(auto x:m){cout<<x.fi<<" "<<x.se<<endl;}cout<<endl;}
inline vi iprefixsum(vi& a){vi b;b.pb(a[0]);go(i,1,a.size()){b.pb(a[i]+b[i-1]);}return b;}
inline vi isuffixsum(vi& a){vi b(sz(a));b[sz(a)-1]=a[sz(a)-1];og(i,0,sz(a)-1){b[i]=a[i]+b[i+1];}return b;}
inline vll llprefixsum(vll& a){vll b;b.pb(a[0]);go(i,1,a.size()){b.pb(a[i]+b[i-1]);}return b;}
inline vll llsuffixsum(vll& a){vll b(sz(a));b[sz(a)-1]=a[sz(a)-1];og(i,0,sz(a)-1){b[i]=a[i]+b[i+1];}return b;}
int main(){ios;solve();return 0;}
//--------SOLVE---------------------------------------------------------------------
int findSubarraySum(int arr[], int n, int sum)
{
    // STL map to store number of subarrays
    // starting from index zero having 
    // particular value of sum.
    unordered_map<int, int> prevSum;
 
    int res = 0;
 
    // Sum of elements so far.
    int currsum = 0;
 
    for (int i = 0; i < n; i++) {
 
        // Add current element to sum so far.
        currsum += arr[i];
 
        // If currsum is equal to desired sum,
        // then a new subarray is found. So
        // increase count of subarrays.
        if (currsum == sum) 
            res++;        
 
        // currsum exceeds given sum by currsum 
        //  - sum. Find number of subarrays having 
        // this sum and exclude those subarrays
        // from currsum by increasing count by 
        // same amount.
        if (prevSum.find(currsum - sum) != 
                                  prevSum.end()) 
            res += (prevSum[currsum - sum]);
         
 
        // Add currsum value to count of 
        // different values of sum.
        prevSum[currsum]++;
    }
 
    return res;
}



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

Measured memory_bytes: 256