import java.io.*;
import java.util.*;

//Problem "Oranges"
//9th Internet Olympiad, basic level, season 2007-2008
//Problem Author: Fedor Tsarev, tsarev@rain.ifmo.ru
//Solution Author: Maxim Buzdalov, buzdalov@rain.ifmo.ru

public class orange_mb {
    public static void main(String[] args) throws IOException {
	Scanner in = new Scanner(new File("orange.in"));
	int friends = in.nextInt();
	int oranges = in.nextInt();
	in.close();
	
	assert (1 <= friends && friends <= 1000000000) : "Friends number is out of bounds";
	assert (1 <= oranges && oranges <= 1000000000) : "Oranges number is out of bounds";
	
	int a = friends, b = oranges;
	while (a > 0) {
	    int t = b % a;
	    b = a;
	    a = t;
	}
	
	PrintWriter out = new PrintWriter("orange.out");
	out.println(friends / b);
	out.close();
    }
}
