#include<bits/stdc++.h>
using namespace std;
int n,m,t;
int main(){
	cin>>n>>m;
	while(m!=0){
		m=n%m;
		t++;
	}
	cout<<t;
	return 0;
}