/* -*- coding: utf-8 -*- * * 415.cc: No.415 ใดใ‚‡ใ‚“ - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ /* typedef */ /* global variables */ /* subroutines */ /* main */ int main() { int n, d; cin >> n >> d; printf("%d\n", n / __gcd(n, d) - 1); return 0; }