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

/*
 * Created by Epsilon Alpha on 12-Sep-16 at 5:07 AM.
 */

public final class NewYearCandles
{
    public static void main(String[] args) throws Exception
    {
        Parser Reader = new Parser(System.in);
        OutputWriter Writer = new OutputWriter(System.out);
        int a = Reader.nextInt();
        int b = Reader.nextInt();
        int wentOut = 0;
        int hours = 0;
        while(a>0)
        {
            a--;
            wentOut++;
            if(wentOut%b==0)
                a++;
            hours++;
        }
        Writer.println(hours);
        Writer.close();
    }

    private static class Parser
    {
        final private int BUFFER_SIZE = 1 << 16;

        private DataInputStream din;
        private byte[] buffer;
        private int bufferPointer, bytesRead;

        public Parser(InputStream in)
        {
            din = new DataInputStream(in);
            buffer = new byte[BUFFER_SIZE];
            bufferPointer = bytesRead = 0;
        }

        public int nextInt() throws Exception
        {
            int ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = c == '-';
            if (neg) c = read();
            do
            {
                ret = ret * 10 + c - '0';
                c = read();
            } while (c > ' ');
            if (neg) return -ret;
            return ret;
        }

        public long nextLong() throws Exception
        {
            long ret = 0;
            byte c = read();
            while (c <= ' ') c = read();
            boolean neg = c == '-';
            if (neg) c = read();
            do
            {
                ret = ret * 10 + c - '0';
                c = read();
            } while (c > ' ');
            if (neg) return -ret;
            return ret;
        }

        public String next() throws Exception
        {
            StringBuffer ret = new StringBuffer();
            byte c = read();
            while (c <= ' ') c = read();
            do
            {
                ret = ret.append((char) c);
                c = read();
            } while (c > ' ');
            return ret.toString();
        }

        private void fillBuffer() throws Exception
        {
            bytesRead = din.read(buffer, bufferPointer = 0, BUFFER_SIZE);
            if (bytesRead == -1) buffer[0] = -1;
        }

        private byte read() throws Exception
        {
            if (bufferPointer == bytesRead) fillBuffer();
            return buffer[bufferPointer++];
        }
    }

    private static class OutputWriter
    {
        private final PrintWriter writer;

        public OutputWriter(OutputStream outputStream)
        {
            writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream)), true);
        }

        public OutputWriter(Writer writer)
        {
            this.writer = new PrintWriter(writer);
        }

        public void print(Object... objects)
        {
            for (int i = 0; i < objects.length; i++)
            {
                if (i != 0)
                    writer.print(' ');
                writer.print(objects[i]);
            }
        }

        public void println(Object... objects)
        {
            print(objects);
            writer.println();
        }

        public void close()
        {
            writer.close();
        }

        public void flush()
        {
            writer.flush();
        }
    }
}