import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;

public class A
{

    public static void main(String[] args)
    {
        MyScanner in = new MyScanner();
        
        int a = in.nextInt();
        int b = in.nextInt();
        
        int ans = 0;
        
        int burnt = 0;
        while (a > 0)
        {
            a--;
            burnt++;
            if (burnt == b) {
                a++;
                burnt = 0;
            }
            ans++;
        }
        
        System.out.println(ans);

    }


    //-----------MyScanner class for faster input----------
    public static class MyScanner
    {
        BufferedReader  br;
        StringTokenizer st;


        public MyScanner()
        {
            br = new BufferedReader(new InputStreamReader(System.in));
        }


        String next()
        {
            while (st == null || !st.hasMoreElements())
            {
                try
                {
                    st = new StringTokenizer(br.readLine());
                }
                catch (IOException e)
                {
                    e.printStackTrace();
                }
            }
            return st.nextToken();
        }


        int nextInt()
        {
            return Integer.parseInt(next());
        }


        long nextLong()
        {
            return Long.parseLong(next());
        }


        double nextDouble()
        {
            return Double.parseDouble(next());
        }


        String nextLine()
        {
            String str = "";
            try
            {
                str = br.readLine();
            }
            catch (IOException e)
            {
                e.printStackTrace();
            }
            return str;
        }

    }
    //--------------------------------------------------------    
}
