#include <iostream>
using namespace std;

int main()
{
    int64_t t, r;
    cin >> t >> r;

    int64_t target = t - (1+r) * (t/(1+r));
    if (target <= r && target != 0)
        cout << 1 << endl;
    else
        cout << 0 << endl;
}