#include #include using namespace std; int main(void){ int m, n; cin >> m >> n; int ans = 0; if (m == 0 || n == 0){ cout << -1 << endl; return 0; } while (n != m){ ans++; if (m >= n) m -= n; else swap(m, n); } cout << ans << endl; return 0; }