import java.util.*;
import java.util.Scanner;
public class Sa
{
	public static void main(String args[])
  	{
	    Scanner s = new Scanner(System.in);
	    int n = s.nextInt();
	   	int m = s.nextInt();
	   	System.out.println((n*m-1)/(m-1));

	}
}