#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define INF 1e9
#define PI 3.14159265359
#define MOD 1000000007
#define ALL(v) v.begin(),v.end()
#define ALLR(v) v.rbegin(),v.rend()
typedef long long ll;
const int dx[4] = {1,0,-1,0};
const int dy[4] = {0,1,0,-1};
//isPrime
//modpow modinv
//getDigit
int main() {
  cout << fixed << setprecision(10);
  double n,k;
  cin >> n >> k;
  cout << (int)(ceil(n/k)-floor(n/k)) << endl;
}


#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <map>
#include <tuple>
#include <cmath>
#include <cstdio>
#include <cassert>
#include <functional>
#define _LIBCPP_DEBUG 0
using namespace std;


int main(void){
    int l,r;
    cin >> l >> r;
    int mi=2018*2018;
    for (int  i = l; i<r; i++)
    {   
        int L=i%2019;
        for (int j = i+1; j <= r; j++)
        {
            int R=j%2019;
            int ama=(L*R)%2019;
            if (ama<mi)
            {
                mi=ama;
                if (mi==0)
                {
                    cout << 0 << endl;
                    return 0;
                }
            }
        }
    }
    cout << mi << endl;
    
}
