Sasha is a very happy guy, that's why he is always on the move. There are $$$n$$$ cities in the country where Sasha lives. They are all located on one straight line, and for convenience, they are numbered from $$$1$$$ to $$$n$$$ in increasing order. The distance between any two adjacent cities is equal to $$$1$$$ kilometer. Since all roads in the country are directed, it's possible to reach the city $$$y$$$ from the city $$$x$$$ only if $$$x < y$$$. Once Sasha decided to go on a trip around the country and to visit all $$$n$$$ cities. He will move with the help of his car, Cheetah-2677. The tank capacity of this model is $$$v$$$ liters, and it spends exactly $$$1$$$ liter of fuel for $$$1$$$ kilometer of the way. At the beginning of the journey, the tank is empty. Sasha is located in the city with the number $$$1$$$ and wants to get to the city with the number $$$n$$$. There is a gas station in each city. In the $$$i$$$-th city, the price of $$$1$$$ liter of fuel is $$$i$$$ dollars. It is obvious that at any moment of time, the tank can contain at most $$$v$$$ liters of fuel.Sasha doesn't like to waste money, that's why he wants to know what is the minimum amount of money is needed to finish the trip if he can buy fuel in any city he wants. Help him to figure it out!

The first line contains two integers $$$n$$$ and $$$v$$$ ($$$2 \le n \le 100$$$, $$$1 \le v \le 100$$$)  — the number of cities in the country and the capacity of the tank.

Print one integer — the minimum amount of money that is needed to finish the trip.

NoteIn the first example, Sasha can buy $$$2$$$ liters for $$$2$$$ dollars ($$$1$$$ dollar per liter) in the first city, drive to the second city, spend $$$1$$$ liter of fuel on it, then buy $$$1$$$ liter for $$$2$$$ dollars in the second city and then drive to the $$$4$$$-th city. Therefore, the answer is $$$1+1+2=4$$$.In the second example, the capacity of the tank allows to fill the tank completely in the first city, and drive to the last city without stops in other cities.

namespace Problem
{
    using System;
    class Strop
    {
        static void Main()
        {
            string[] str = Console.ReadLine().Split();
            int n = int.Parse( str[0] );
            int v = int.Parse( str[1] );

            int soTien = n>v? v-1:n-1;
            int i = 1;
            while(n > v)
            {
                soTien += i;
                i++;
                n--;
            }
            Console.WriteLine( soTien );
        }
    }
}

// Problem: 1113A - Sasha and His Trip
// Author: Gusztav Szmolik

using System;

class SashaAndHisTrip
    {
    static int Main ()
        {
        string line = Console.ReadLine ();
        if (line == null)
            return -1;
        char[] delims = {' ', '\t'};
        string[] words = line.Split (delims,StringSplitOptions.RemoveEmptyEntries);
        if (words.Length != 2)
            return -1;
        byte n;
        if (!Byte.TryParse (words[0], out n))
            return -1;
        if (n < 2 || n > 100)
            return -1;
        byte v;
        if (!Byte.TryParse (words[1], out v))
            return -1;
        if (v < 1 || v > 100)
            return -1;
        byte remainKm = Convert.ToByte (n-1);
        ushort ans;
        if (remainKm <= v)
            ans = remainKm;
        else
            {
            ans = v;
            remainKm -= v;
            ans += Convert.ToUInt16 ((remainKm+3)*remainKm/2);
            }
        Console.WriteLine (ans);
        return 0;
        }
    }

using System;

namespace Sasha_Trip
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] entries = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);

            int dolars = 0;

            if (entries[1] >= (entries[0] - 1))
            {
                dolars = (entries[1] == (entries[0] - 1)) ? entries[1]: entries[0] - 1;
            }
            else
            {
                int fuel = 0, lim = 0;

                for (int i = 1; i < entries[0]; i++)
                {
                    if (lim == entries[0] - 1)
                    {
                        break;
                    }
                    if (fuel < entries[1])
                    {
                        for (int j = fuel; j < entries[1]; j++, fuel++, lim++)
                            dolars += i;
                    }
                    fuel--;
                }
            }

            Console.WriteLine("{0}", dolars);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using SB = System.Text.StringBuilder;
//using System.Text.RegularExpressions;
//using System.Globalization;
//using System.Diagnostics;
using static System.Console;
using System.Numerics;
using static System.Math;
using pair = Pair<long, long>;

class Program
{
    static void Main()
    {
        //SetOut(new StreamWriter(OpenStandardOutput()) { AutoFlush = false });
        new Program().solve();
        Out.Flush();
    }
    readonly Scanner cin = new Scanner();
    readonly int[] dd = { 0, 1, 0, -1, 0 }; //→↓←↑
    readonly int mod = 1000000007;
    readonly int dom = 998244353;
    bool chmax<T>(ref T a, T b) where T : IComparable<T> { if (a.CompareTo(b) < 0) { a = b; return true; } return false; }
    bool chmin<T>(ref T a, T b) where T : IComparable<T> { if (b.CompareTo(a) < 0) { a = b; return true; } return false; }

    void solve()
    {
        int N = cin.nextint;
        int V = cin.nextint;
        int ANS = 0;
        int WANT = N - 1;
        int M = 0;
        for (int i = 0; i < N - 1; i++)
        {
            while (WANT > 0 && M < V)
            {
                WANT--;
                M++;
                ANS += i + 1;
            }
            M--;
        }
        WriteLine(ANS);
    }

}

static class Ex
{
    public static void join<T>(this IEnumerable<T> values, string sep = " ") => WriteLine(string.Join(sep, values));
    public static string concat<T>(this IEnumerable<T> values) => string.Concat(values);
    public static string reverse(this string s) { var t = s.ToCharArray(); Array.Reverse(t); return t.concat(); }

    public static int lower_bound<T>(this IList<T> arr, T val) where T : IComparable<T>
    {
        int low = 0, high = arr.Count;
        int mid;
        while (low < high)
        {
            mid = ((high - low) >> 1) + low;
            if (arr[mid].CompareTo(val) < 0) low = mid + 1;
            else high = mid;
        }
        return low;
    }
    public static int upper_bound<T>(this IList<T> arr, T val) where T : IComparable<T>
    {
        int low = 0, high = arr.Count;
        int mid;
        while (low < high)
        {
            mid = ((high - low) >> 1) + low;
            if (arr[mid].CompareTo(val) <= 0) low = mid + 1;
            else high = mid;
        }
        return low;
    }
}

class Pair<T, U> : IComparable<Pair<T, U>> where T : IComparable<T> where U : IComparable<U>
{
    public T f; public U s;
    public Pair(T f, U s) { this.f = f; this.s = s; }
    public int CompareTo(Pair<T, U> a) => f.CompareTo(a.f) != 0 ? f.CompareTo(a.f) : s.CompareTo(a.s);
    public override string ToString() => $"{f} {s}";
}

class Scanner
{
    string[] s; int i;
    readonly char[] cs = new char[] { ' ' };
    public Scanner() { s = new string[0]; i = 0; }
    public string[] scan => ReadLine().Split();
    public int[] scanint => Array.ConvertAll(scan, int.Parse);
    public long[] scanlong => Array.ConvertAll(scan, long.Parse);
    public double[] scandouble => Array.ConvertAll(scan, double.Parse);
    public string next
    {
        get
        {
            if (i < s.Length) return s[i++];
            string st = ReadLine();
            while (st == "") st = ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
            return next;
        }
    }
    public int nextint => int.Parse(next);
    public long nextlong => long.Parse(next);
    public double nextdouble => double.Parse(next);
}

#region Usings
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;

using static System.Math;
#endregion

// https://codeforces.com/problemset/problem/1113/A
public class A___Sasha_and_His_Trip
{
    private static void Solve()
    {
        int n = ReadInt();
        int v = ReadInt();

        // Pre-load tank (v) for last cities
        int result = Min(n - 1, v);

        // Keep tank at maximun in first (cheapest) cities
        for (int i = 2; i <= n - v; i++)
        {
            result += i;
        }

        Write(result);
    }

    #region Main

    private static TextReader reader;
    private static TextWriter writer;

    public static void Main()
    {
#if DEBUG

        //reader = new StreamReader("C:\\Users\\Axel\\Desktop\\input.txt");
        reader = new StreamReader(Console.OpenStandardInput());
        writer = Console.Out;

        //writer = new StreamWriter("..\\..\\output.txt");
#else
        reader = new StreamReader(Console.OpenStandardInput());
        writer = new StreamWriter(Console.OpenStandardOutput());

        //reader = new StreamReader("input.txt");
        //writer = new StreamWriter("output.txt");
#endif
        try
        {
            Solve();

            //var thread = new Thread(new String_Task().Solve, 1024 * 1024 * 128);
            //thread.Start();
            //thread.Join();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
#if DEBUG
#else
            throw;
#endif
        }
        reader.Close();
        writer.Close();
    }

    #endregion Main

    #region Read / Write

    private static Queue<string> currentLineTokens = new Queue<string>();

    private static string[] ReadAndSplitLine()
    {
        return reader.ReadLine().Split(new[] { ' ', '\t', }, StringSplitOptions.RemoveEmptyEntries);
    }

    public static string Read()
    {
        while (currentLineTokens.Count == 0) currentLineTokens = new Queue<string>(ReadAndSplitLine()); return currentLineTokens.Dequeue();
    }

    public static int ReadInt()
    {
        return int.Parse(Read());
    }

    public static long ReadLong()
    {
        return long.Parse(Read());
    }

    public static double ReadDouble()
    {
        return double.Parse(Read(), CultureInfo.InvariantCulture);
    }

    public static int[] ReadIntArray()
    {
        return ReadAndSplitLine().Select(int.Parse).ToArray();
    }

    public static long[] ReadLongArray()
    {
        return ReadAndSplitLine().Select(long.Parse).ToArray();
    }

    public static double[] ReadDoubleArray()
    {
        return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();
    }

    public static int[][] ReadIntMatrix(int numberOfRows)
    {
        int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix;
    }

    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }
        return ret;
    }

    public static string[] ReadLines(int quantity)
    {
        string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines;
    }

    public static void WriteArray<T>(IEnumerable<T> array)
    {
        writer.WriteLine(string.Join(" ", array));
    }

    public static void Write(params object[] array)
    {
        WriteArray(array);
    }

    public static void WriteLines<T>(IEnumerable<T> array)
    {
        foreach (var a in array) writer.WriteLine(a);
    }

    private class SDictionary<TKey, TValue> : Dictionary<TKey, TValue>
    {
        public new TValue this[TKey key]
        {
            get { return ContainsKey(key) ? base[key] : default(TValue); }
            set { base[key] = value; }
        }
    }

    private static T[] Init<T>(int size) where T : new()
    {
        var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret;
    }

    #endregion Read / Write
}

using System;
using System.Collections.Generic;
using System.Linq;

namespace Codeforces
{
	class Program
	{
		static void Main(string[] args)
		{
			string input1 = Console.ReadLine();
			//string input2 = Console.ReadLine();

			//string input3 = Console.ReadLine();
			//string input4 = Console.ReadLine();

			var inputs1 = input1.Split(new[] { ' ', '}', '{' , ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();
			//var inputs2 = input2.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();

			long n = inputs1[0];
			long v = inputs1[1];

			long sum = Math.Min(n - 1, v);
			for (long i = 2; i <= n - v; i++)
			{
				sum += i;
			}

			Console.WriteLine(sum);
		}
	}
}

using System;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] input = Array.ConvertAll(Console.ReadLine().Split(), Int32.Parse);
            int minus = input[0] - input[1] - 1;
            if (minus <= 0)
            {
                Console.WriteLine(input[0] - 1);
            }
            else
            {
                Console.WriteLine(input[1] + (3 + minus) * minus / 2);
            }
        }
    }
}

using System;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), Int32.Parse);
            int minus = input[0] - input[1] - 1;
            if (minus <= 0)
            {
                Console.WriteLine(input[0] - 1);
            }
            else
            {
                Console.WriteLine(input[1] + (3 + minus) * minus / 2);
            }
        }
    }
}

using System;

namespace SimpleConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().ToString();
            var cities = Int32.Parse(input.Split(" ")[0].ToString());
            var fuelCapacity = Int32.Parse(input.Split(" ")[1]);

            var resultingAmount = 0;
            var fuelLevel = 1;

            for (int i = 0; i < cities; i++)
            {
                if(cities - fuelLevel  - i <= 0)
                {
                    break;
                }

                fuelLevel--;
               if (i == 0)
                {
                    resultingAmount += fuelCapacity >= cities ? cities - 1: fuelCapacity ;
                    fuelLevel = fuelCapacity >= cities ? cities : fuelCapacity;
                }
                else if (fuelLevel < fuelCapacity)
                {
                    resultingAmount += i + 1;
                    fuelLevel++;
                }
            }
            Console.Write(resultingAmount);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace codeforces539
{
    class Program
    {
        static void Main(string[] args)
        {
            var sp = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();
            int sol = 0;
            int v = 0;
            for(int i = 0; i < sp[0]; ++i, --v)
            {
                if (v >= sp[0] - i - 1)
                    break;
                sol += Math.Min(sp[0] - i - 1, sp[1] - v) * (i + 1);
                v += Math.Min(sp[0] - i - 1, sp[1] - v);
            }
            Console.WriteLine(sol);
        }
    }
}

using System;
using System.Linq;

namespace codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int rez = 0;
            if (a[1] >= a[0])
                rez = a[0]-1;
            else
            {
                int c = a[0] - a[1];
                rez = a[1];
                for (int i = 2; i <= c; i++)
                    rez += i;
            }

            Console.WriteLine(rez);
        }
    }
}

using System;
using System.Linq;
using System.Collections.Generic;

static class UtilityMethods
{
	public static void Swap<T>(ref T a, ref T b)
	{
		T t = a;
		a = b;
		b = t;
	}

	public static int StrToInt(string s)
	{
		int number = 0;
		for (int i = s[0] == '-' ? 1 : 0; i < s.Length; i++)
			number = number * 10 + (s[i] - '0');
		return s[0] == '-' ? -number : number;
	}
	public static long StrToLong(string s)
	{
		long number = 0;
		for (int i = s[0] == '-' ? 1 : 0; i < s.Length; i++)
			number = number * 10 + (s[i] - '0');
		return s[0] == '-' ? -number : number;
	}

	public static string ReadString() => Console.ReadLine();
	public static int ReadInt() => StrToInt(ReadString());
	public static long ReadLong() => StrToLong(ReadString());
	public static double ReadDouble() => double.Parse(ReadString());

	public static string[] ReadStringArray() => ReadString().Split();
	public static int[] ReadIntArray() => Array.ConvertAll(ReadStringArray(), StrToInt);
	public static long[] ReadLongArray() => Array.ConvertAll(ReadStringArray(), StrToLong);
	public static double[] ReadDoubleArray() => ReadStringArray().Select(double.Parse).ToArray();

	public static void WriteLine(object a) => Console.WriteLine(a);
	public static void WriteLineArray<T>(string separator, T[] a, int startIndex, int count)
	{
		const int MAXLEN = 1000000;
		int len = 0, j = startIndex, lastIndex = startIndex + count;
		System.Text.StringBuilder str;
		string[] b = Array.ConvertAll(a, x => x.ToString());
		for (int i = startIndex; i < lastIndex - 1; i++)
		{
			len += b[i].Length + separator.Length;
			if (len >= MAXLEN)
			{
				str = new System.Text.StringBuilder(len);
				for (; j <= i; j++)
				{
					str.Append(b[j]);
					str.Append(separator);
				}
				Console.Write(str);
				len = 0;
			}
		}
		str = new System.Text.StringBuilder(len);
		for (; j < lastIndex - 1; j++)
		{
			str.Append(b[j]);
			str.Append(separator);
		}
		Console.Write(str);
		Console.WriteLine(b.Last());
	}
}

class Program
{
	static void Main()
	{
		int[] data = UtilityMethods.ReadIntArray();
		int n = data[0], v = data[1];
		int cost = 0, volume = 0;
		for (int i = 1; i <= n; i++, volume--)
			if (volume + i < n)
			{
				cost += (v - volume) * i;
				volume += v - volume;
			}
			else
				break;
		UtilityMethods.WriteLine(n - 1 <= v ? n - 1 : cost);
		Console.ReadLine();
	}
}

using System;

namespace CSharp
{
    class _1113A
    {
        public static void Main()
        {
            var tokens = Console.ReadLine().Split();

            int n = int.Parse(tokens[0]);
            int v = int.Parse(tokens[1]);

            int last = Math.Max(1, n - v);
            Console.WriteLine(last * (last + 1) / 2 + n - last - 1);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO.Pipes;
using System.Linq;
using System.Numerics;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;

class Test
{

    static long MOD = 1000000007;
    static long[] fact = new long[500001];
    static long[] factInv = new long[500001];

    // Driver code
    public static void Main()
    {

        // int t = int.Parse(Console.ReadLine());
        // while (t > 0)
        {
            // t--;
            var input1 = Console.ReadLine().Split(' ').Select(xx => long.Parse(xx)).ToArray();
            var n = input1[0];
            var v = input1[1];
            if (n <= v)
            {
                Console.WriteLine(n - 1);
            }
            else
            {
                var ans = v;

                for (int i = 2; i <= n - v; i++)
                {
                    ans = ans + i;
                }

                Console.WriteLine(ans);
            }

        }
    }

    public static long FastPower(long a, long b)
    {
        if (b == 0)
            return 1;

        var val = FastPower(a, b / 2);

        if (b % 2 == 0)
            return val * val % MOD;
        else
            return val * val % MOD * a % MOD;
    }

    public static void Fact()
    {
        fact[0] = 1;
        factInv[0] = FastPower(fact[0], MOD - 2);

        for (int i = 1; i <= 500000; i++)
        {
            fact[i] = i * fact[i - 1] % MOD;
            factInv[i] = FastPower(fact[i], MOD - 2);
        }

    }

    public static long NCR(long n, long r)
    {
        return fact[n] * factInv[r] % MOD * factInv[n - r] % MOD;
    }
}

using System;
using System.Collections.Generic;
using System.Collections;

namespace codeforces
{

    public class Program
    {
        private static void Main(string[] args)
        {
            var values = Console.ReadLine().Split(' ');
            int n = Convert.ToInt32(values[0]);
            int v = Convert.ToInt32(values[1]);
            var dp = new int[n, v + 1];
            for (int i = 0; i <= v; ++i)
            {
                dp[0, i] = i;
            }
            for (int i = 1; i < n; ++i)
            {
                for (int j = 0; j <= v; ++j)
                {
                    int value = int.MaxValue;
                    for (int k = 0; k <= j; ++k)
                    {
                        if (j - k + 1 <= v)
                        {
                            value = Math.Min(value, dp[i - 1, j - k + 1] + (i + 1) * k);
                        }
                    }
                    dp[i, j] = value;
                }
            }
            int result = int.MaxValue;
            for (int i = 0; i <= v; ++i)
            {
                result = Math.Min(result, dp[n - 1, i]);
            }
            Console.WriteLine(result.ToString());

            Console.Read();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using static System.Array;
using static System.Console;
using static System.Math;

namespace Olymp
{
  public class ProblemSolver
  {
    private readonly Tokenizer input;

    public void Solve()
    {
      var (n, v) = input.Read2Int();
      Write(v >= n - 1 ? n - 1 : v + (n - v) * (n - v + 1) / 2 - 1);
    }

    public ProblemSolver(TextReader input)
    {
      this.input = new Tokenizer(input);
    }
  }

  #region Service classes

  public class Tokenizer
  {
    private readonly TextReader reader;

    public string ReadToEnd() => reader.ReadToEnd();

    public int ReadInt()
    {
      var c = SkipWs();
      if (c == -1)
        throw new EndOfStreamException();
      var isNegative = false;
      if (c == '-' || c == '+')
      {
        isNegative = c == '-';
        c = reader.Read();
        if (c == -1)
          throw new EndOfStreamException("Digit expected, but end of stream occurs");
      }

      if (!char.IsDigit((char)c))
        throw new InvalidOperationException($"Digit expected, but was: '{(char)c}'");

      checked
      {
        var result = (char)c - '0';
        c = reader.Read();
        while (c > 0 && !char.IsWhiteSpace((char)c))
        {
          if (!char.IsDigit((char)c))
            throw new InvalidOperationException($"Digit expected, but was: '{(char)c}'");
          result = result * 10 + (char)c - '0';
          c = reader.Read();
        }

        if (isNegative)
          result = -result;
        return result;
      }
    }

    public string ReadLine() => reader.ReadLine();

    public long ReadLong() => long.Parse(ReadToken());

    public double ReadDouble() => double.Parse(ReadToken(), CultureInfo.InvariantCulture);

    public int[] ReadIntArray(int n)
    {
      var a = new int[n];
      for (var i = 0; i < n; i++)
        a[i] = ReadInt();
      return a;
    }

    public (int, int) Read2Int() => (ReadInt(), ReadInt());

    public (int, int, int) Read3Int() => (ReadInt(), ReadInt(), ReadInt());

    public (int, int, int, int) Read4Int() => (ReadInt(), ReadInt(), ReadInt(), ReadInt());

    public (long, long) Read2Long() => (ReadLong(), ReadLong());

    public long[] ReadLongArray(int n)
    {
      var a = new long[n];
      for (var i = 0; i < n; i++)
        a[i] = ReadLong();
      return a;
    }

    public double[] ReadDoubleArray(int n)
    {
      var a = new double[n];
      for (var i = 0; i < n; i++)
        a[i] = ReadDouble();
      return a;
    }

    public string ReadToken()
    {
      var c = SkipWs();
      if (c == -1)
        return null;
      var sb = new StringBuilder();
      while (c > 0 && !char.IsWhiteSpace((char)c))
      {
        sb.Append((char)c);
        c = reader.Read();
      }

      return sb.ToString();
    }

    private int SkipWs()
    {
      var c = reader.Read();
      if (c == -1)
        return c;
      while (c > 0 && char.IsWhiteSpace((char)c))
        c = reader.Read();
      return c;
    }

    public Tokenizer(TextReader reader)
    {
      this.reader = reader;
    }
  }

  internal class Program
  {
    public static void Main()
    {
      var solver = new ProblemSolver(In);
      solver.Solve();
    }
  }

  #endregion
}

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using static System.Array;
using static System.Console;
using static System.Math;

namespace Olymp
{
  public class ProblemSolver
  {
    private readonly Tokenizer input;

    public void Solve()
    {
      var (n, v) = input.Read2Int();
      if (v >= n - 1)
      {
        Write(n - 1);
      }
      else
      {
        var s = v;
        for (int i = 2; i <= n - v; i++)
        {
          s += i;
        }
        Write(s);
      }
    }

    public ProblemSolver(TextReader input)
    {
      this.input = new Tokenizer(input);
    }
  }

  #region Service classes

  public class Tokenizer
  {
    private readonly TextReader reader;

    public string ReadToEnd() => reader.ReadToEnd();

    public int ReadInt()
    {
      var c = SkipWs();
      if (c == -1)
        throw new EndOfStreamException();
      var isNegative = false;
      if (c == '-' || c == '+')
      {
        isNegative = c == '-';
        c = reader.Read();
        if (c == -1)
          throw new EndOfStreamException("Digit expected, but end of stream occurs");
      }

      if (!char.IsDigit((char)c))
        throw new InvalidOperationException($"Digit expected, but was: '{(char)c}'");

      checked
      {
        var result = (char)c - '0';
        c = reader.Read();
        while (c > 0 && !char.IsWhiteSpace((char)c))
        {
          if (!char.IsDigit((char)c))
            throw new InvalidOperationException($"Digit expected, but was: '{(char)c}'");
          result = result * 10 + (char)c - '0';
          c = reader.Read();
        }

        if (isNegative)
          result = -result;
        return result;
      }
    }

    public string ReadLine() => reader.ReadLine();

    public long ReadLong() => long.Parse(ReadToken());

    public double ReadDouble() => double.Parse(ReadToken(), CultureInfo.InvariantCulture);

    public int[] ReadIntArray(int n)
    {
      var a = new int[n];
      for (var i = 0; i < n; i++)
        a[i] = ReadInt();
      return a;
    }

    public (int, int) Read2Int() => (ReadInt(), ReadInt());

    public (int, int, int) Read3Int() => (ReadInt(), ReadInt(), ReadInt());

    public (int, int, int, int) Read4Int() => (ReadInt(), ReadInt(), ReadInt(), ReadInt());

    public (long, long) Read2Long() => (ReadLong(), ReadLong());

    public long[] ReadLongArray(int n)
    {
      var a = new long[n];
      for (var i = 0; i < n; i++)
        a[i] = ReadLong();
      return a;
    }

    public double[] ReadDoubleArray(int n)
    {
      var a = new double[n];
      for (var i = 0; i < n; i++)
        a[i] = ReadDouble();
      return a;
    }

    public string ReadToken()
    {
      var c = SkipWs();
      if (c == -1)
        return null;
      var sb = new StringBuilder();
      while (c > 0 && !char.IsWhiteSpace((char)c))
      {
        sb.Append((char)c);
        c = reader.Read();
      }

      return sb.ToString();
    }

    private int SkipWs()
    {
      var c = reader.Read();
      if (c == -1)
        return c;
      while (c > 0 && char.IsWhiteSpace((char)c))
        c = reader.Read();
      return c;
    }

    public Tokenizer(TextReader reader)
    {
      this.reader = reader;
    }
  }

  internal class Program
  {
    public static void Main()
    {
      var solver = new ProblemSolver(In);
      solver.Solve();
    }
  }

  #endregion
}

using System;
using System.Collections;
using System.Collections.Generic;
class solution
{
    static void Main(string[] args)
    {
        string[] ab = Console.ReadLine().Split(' ');
        int n = Convert.ToInt32(ab[0]);
        int v = Convert.ToInt32(ab[1]);
        int current = 1, totalmoney = 0;
        if (v >= n) Console.Write(n - 1);
        else
        {
            while (current < n)
            {
                if (n - current >= v)
                {
                    if (current == 1) totalmoney += v * current;
                    else totalmoney += current;
                }
                current++;
            }
            Console.Write(totalmoney);
        }
    }
}

using System;
using System.Linq;

namespace Div._2
{
    class Program
    {
        static void Main(string[] args)
        {
            var nv = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();

            var travelNumber = nv[0] - 1;
            var gasoline = nv[1];

            var result = 0;

            if (gasoline >= travelNumber)
                result = travelNumber;
            else
            {
                var count = 2;
                result = gasoline;
                travelNumber -= gasoline;
                while (travelNumber-- > 0)
                    result += count++;
            }

            Console.WriteLine(result);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class A1113_SashaAndHisTrip
    {
        public static void Main()
        {
            string[] a = Console.ReadLine().Split(' ');
            int n = int.Parse(a[0]);
            int v = int.Parse(a[1]);
            n--;

            int totalcost = 0;
            if(n>v)
                totalcost = v;
            else
                totalcost = n;

            int i = 2;

            while(v<n)
            {
                v++;
                totalcost += i;
                i++;
            }
            Console.WriteLine(totalcost);
        }
    }
}

using System;
using System.Numerics;
using System.IO;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Text.RegularExpressions;

namespace ProjectEuler
{
    class Program
    {

        private static void Main()
        {
            int[] str = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
            int n = str[0];
            int v = str[1];
            int counter = 1;
            if (v >= n)
            {
                Console.WriteLine(n - 1);
            }
            else
            {
                if (v == n-1)
                {
                    Console.WriteLine(v);
                }
                else
                {
                    for (int i = 0; i < n-v-1; i++)
                    {
                        counter++;
                    }
                    Console.WriteLine(v + (counter * (counter + 1) / 2 - 1));
                }
            }

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;

namespace ConsoleApp
{
    class Program
    {
        static void Main()
        {
            var args = Reader.ReadIntArgs();

            var n = args[0];
            var v = args[1];

            int cur = 0;
            int ans = 0;

            for (int i = 1; i <= n; i++)
            {
                var delta = v - cur;

                cur += delta;
                ans += delta * i;

                if (i + cur >= n)
                {
                    ans -= ((i + cur) - n) * i;
                    break;
                }

                cur--;
            }

            Console.WriteLine(ans);
        }

        static int GetMinDel(int x)
        {
            if (x % 2 == 0)
            {
                return 2;
            }

            int n = (int)Math.Sqrt(x) + 1;

            for (int i = 3; i <= n; i += 2)
            {
                if (x % i == 0)
                {
                    return i;
                }
            }

            return x;
        }
    }

    static class Reader
    {
        public static List<int> ReadIntArgs()
        {
            return ReadArgs(int.Parse);
        }

        public static List<long> ReadLongArgs()
        {
            return ReadArgs(long.Parse);
        }

        private static List<T> ReadArgs<T>(Func<string, T> parser)
        {
            return Console.ReadLine().Split().Select(parser).ToList();
        }

        public static int ReadIntValue()
        {
            return ReadValue(int.Parse);
        }

        public static long ReadLongValue()
        {
            return ReadValue(long.Parse);
        }

        private static T ReadValue<T>(Func<string, T> parser)
        {
            return parser(Console.ReadLine());
        }
    }
}

//var args = Reader.ReadIntArgs();

//var n = args[0];
//var v = args[1];

//int cur = 0;
//int ans = 0;

//for (int i = 1; i <= n; i++)
//{
//    var delta = v - cur;

//    cur += delta;
//    ans += delta * i;

//    if (i + cur >= n)
//    {
//        ans -= ((i + cur) - n) * i;
//        break;
//    }
//    else
//    {
//        cur--;
//    }
//}

//Console.WriteLine(ans);
//Console.ReadKey();

//class Program
//{
//    static void Main()
//    {
//        var n = Reader.ReadIntValue();
//        var line = Reader.ReadIntArgs();
//        line.Sort();

//        int minDel = int.MaxValue;
//        int minDelHolder = int.MinValue;

//        int sum = 0;

//        for (int i = n - 1; i >= 1; i--)
//        {
//            sum += line[i];

//            int del = GetMinDel(line[i]);

//            if (del < minDel)
//            {
//                minDel = del;
//                minDelHolder = line[i];
//            }
//        }

//        Console.WriteLine(sum - minDelHolder + (minDelHolder / minDel) + line[0] * minDel);
//        Console.ReadKey();
//    }

//    static int GetMinDel(int x)
//    {
//        if (x % 2 == 0)
//        {
//            return 2;
//        }

//        int n = (int)Math.Sqrt(x) + 1;

//        for (int i = 3; i <= n; i += 2)
//        {
//            if (x % i == 0)
//            {
//                return i;
//            }
//        }

//        return x;
//    }

//class Program
//{
//    static void Main()
//    {
//        var s = Console.ReadLine();

//        if (s.Length < 4)
//        {
//            Console.WriteLine("Impossible");
//            return;
//        }

//        int mod = s.Length % 2;

//        var start = s[0];

//        for (int i = 1; i < s.Length / 2; i++)
//        {
//            if (s[i] != start)
//            {
//                if (i != 1)
//                    mod++;

//                Console.WriteLine(1 + mod);
//                Console.ReadKey();
//                return;
//            }
//        }

//        Console.WriteLine("Impossible");
//        Console.ReadKey();
//    }

using System;
using System.Linq;
using System.Collections.Generic;

namespace AlgoTasks
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] nv = Console.ReadLine().Split().Select(i => int.Parse(i)).ToArray();
            int n = nv[0];
            int v = nv[1];
            if (n - 1 <= v)
            {
                Console.WriteLine(n - 1);
            }
            else
            {
                int result = v - 1;
                for (int i = 1; i <= n - v; ++i)
                    result += i;
                Console.WriteLine(result);
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;

namespace Algorithms
{
    class Program
    {

        static void Main(string[] args)
        {
            var nAndv = Console.ReadLine().Split();
            var n = int.Parse(nAndv[0]);
            var v = int.Parse(nAndv[1]);
            var result = SashasTrip(n, v);

            Console.WriteLine(result);
        }

        private static int SashasTrip(int numberOfCities, int tankCapacity)
        {
            if (numberOfCities - 1 == tankCapacity)
                return tankCapacity;

            if (tankCapacity > numberOfCities)
                return --numberOfCities;

			if (tankCapacity == numberOfCities)
                return --numberOfCities;

            int totalAmount = 0;
            int cityIndex = 2;

            totalAmount += tankCapacity;
            numberOfCities--;

            while (numberOfCities-- != tankCapacity)
            {
                totalAmount += cityIndex;

                cityIndex++;
            }

            return totalAmount;
        }

    }
}

using System;
namespace Codeforces
{
    class Program
    {
        static void Main(string[] args)
        {

            string[] ab = Console.ReadLine().Split();
            int n = int.Parse(ab[0]);
            int v = int.Parse(ab[1]);

            if(v >= n - 1)
            {
                Console.WriteLine(n - 1);
            }
            else
            {
                int i = 2;
                int liters = v ;
                int money = 1 * liters;
                while (i < n)
                {
                    liters--;
                    int c = v - liters;
                    liters += c;
                    money += c * i;
                    if(liters >= n - i)
                    {
                        break;
                    }
                    i++;
                }
                Console.WriteLine(money);
            }

        }

        static int convertToInt(string n)
        {
            return int.Parse(n);
        }
    }
}

using System;
using System.IO;
using System.Text;

namespace Sasha_and_His_Trip
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            writer.WriteLine(Solve(args));
            writer.Flush();
        }

        private static int Solve(string[] args)
        {
            int n = Next();
            int v = Next();

            if (n <= v)
                return n - 1;

            return v - 1 + (n - v)*(n - v + 1)/2;
        }

        private static int Next()
        {
            int c;
            int res = 0;
            do
            {
                c = reader.Read();
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return res;
                res *= 10;
                res += c - '0';
            }
        }
    }
}

using System;
using System.Linq;

namespace ConsoleApplication2
{
internal class Program
{
public static void Main(string[] args)
{
int[] array = Console.ReadLine().Split().Select(n => int.Parse(n)).ToArray();
int ans = 0;
//if (array[1] == array[0] - 1) ans = array[1];
if (array[1] >= array[0] - 1) ans = array[0] - 1;
else if (array[1] < array[0])
{
ans += array[1];
for (int i = 1; i <= array[0]; i++)
{
if (array[0] - i != array[1] - 1)
ans += i;
else
break;
}
}
if (array[0] == 1) Console.WriteLine(1);
else if (array[1] >= array[0] - 1)
Console.WriteLine(ans);
else
{
Console.WriteLine(ans - 1);
}
}
}
}

using System;
using System.Linq;

namespace ConsoleApplication2
{
    internal class Program
    {
        public static void Main(string[] args)
        {
            int[] array = Console.ReadLine().Split().Select(n => int.Parse(n)).ToArray();
            int first = array[0];
            int second = array[1];
            int result = 0;
            if (second >= first - 1) result = first - 1;
            else if (second < first)
            {
                result += second;
                for (int i = 1; i <= first; i++)
                {
                    if (first - i != second - 1)
                    result += i;
                    else
                        break;
                }
            }
            if (first == 1)
                Console.WriteLine(1);
            else if (second >= first - 1)
                Console.WriteLine(result);
            else
                Console.WriteLine(result - 1);
        }
    }
}

//#define EXTENDSTACKSIZE

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;

namespace CF
{
    internal class Program
    {
        private const int stackSize = 64 * 1024 * 1024;

        private static void Run()
        {
            using (var sr = new InputReader(Console.In))
//            using (var sr = new InputReader(new StreamReader("input.txt")))
            using (var sw = Console.Out)
//            using (var sw = new StreamWriter("output.txt"))
            using (var task = new Task(sr, sw)) {
                task.Solve();
//                Console.ReadKey();
            }
        }

        private static void Main(string[] args)
        {
#if EXTENDSTACKSIZE
            var threadStart = new ThreadStart(Run);
            var thread = new Thread(threadStart, stackSize);
            thread.Start();
            thread.Join();
#else
            Run();
#endif
        }
    }

    internal class Task : IDisposable
    {
        private readonly InputReader sr;
        private readonly TextWriter sw;
        private bool isDispose;

        public Task(InputReader sr, TextWriter sw)
        {
            this.sr = sr;
            this.sw = sw;
        }

        public void Solve()
        {
            var n = sr.NextInt32();
            var v = sr.NextInt32();
            var currV = 0;
            var total = 0;
            for (var i = 1; i <= n; i++)
            {
                var need = n - i;
                if (i > 1)
                {
                    currV--;
                }

                if (need <= currV)
                {
                    sw.WriteLine(total);
                    return;
                }

                var d = need - currV;
                if ((d + currV) <= v)
                {
                    total += (d * i);
                    sw.WriteLine(total);
                    return;
                }

                if (i == 1)
                {
                    total += v;
                    currV = v;
                }
                else
                {
                    total += i;
                    currV = v;
                }
            }

            throw new InvalidOperationException();
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        private void Dispose(bool disposing)
        {
            if (!isDispose) {
                if (disposing) {
                    if(sr != null)
                        sr.Dispose();

                    if(sw != null)
                        sw.Dispose();
                }

                isDispose = true;
            }
        }
    }
}

class Pair
{
    public long Value { get; set; }
    public int Count { get; set; }
}

class PairComparer : Comparer<Pair>
{
    public override int Compare(Pair x, Pair y)
    {
        return x.Value.CompareTo(y.Value);
    }
}

internal class InputReader : IDisposable
{
    private bool isDispose;
    private readonly TextReader sr;
    private string[] buffer;
    private int seek;

    public InputReader(TextReader stream)
    {
        sr = stream;
    }

    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    public string NextString()
    {
        var result = sr.ReadLine();
        return result;
    }

    public int NextInt32()
    {
        return Int32.Parse(ReadNextToken());
    }

    private string ReadNextToken()
    {
        if (buffer == null || seek == buffer.Length) {
            seek = 0;
            buffer = NextSplitStrings();
        }

        return buffer[seek++];
    }

    public long NextInt64()
    {
        return Int64.Parse(ReadNextToken());
    }

    public int[] ReadArrayOfInt32()
    {
        return ReadArray(Int32.Parse);
    }

    public long[] ReadArrayOfInt64()
    {
        return ReadArray(Int64.Parse);
    }

    public string[] NextSplitStrings()
    {
        return NextString()
            .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
    {
        return NextSplitStrings()
            .Select(s => func(s, CultureInfo.InvariantCulture))
            .ToArray();
    }

    public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
    {
        return
            str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(s => func(s, CultureInfo.InvariantCulture))
                .ToArray();
    }

    protected void Dispose(bool dispose)
    {
        if (!isDispose)
        {
            if (dispose)
                sr.Close();

            isDispose = true;
        }
    }

    ~InputReader()
    {
        Dispose(false);
    }
}

using System;
class Codeforces_Round_539_A
{
  static void Main()
  {
    string [] s = Console.ReadLine().Split(' ');
    int n = Convert.ToInt32(s[0]);
    int v = Convert.ToInt32(s[1]);
    int [] a = new int [n];
    int i = 0; int t = n-1; int coin = 0;
    for(; i<n; i++)
    {
        a[i] = i+1;
    }
    if(v == t) coin = v * a[0];
    if(v > t) coin = t;
    if(v < t)
    {
        int tb = v; coin = v * a[0];
        for(int k=1; k<n - 1; k++)
        {
            tb--;
            while(tb<v)
            {
                tb++;
                coin = coin+a[k];
            }
            if(tb == n - a[k])
            break;
        }
    }
    Console.Write(coin);
  }
}

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;

class CF {
    static void Main() => CustomMain();

    static void Solve() {
        int n, v;
        ReadMulti(out n, out v);

        var tank = 0;
        var ans = 0;
        for (int i = 1; i < n; i++) {
            if (tank != v && tank < n - i) {
                var addOil = Math.Min(n - i, v - tank);
                tank += addOil;
                ans += i * addOil;
            }

            tank--;
        }

        WriteAnswer(ans);
    }

    static void CustomMain() {
#if DEBUG
        // ファイルからテストケースを読み込む
        global::Common.ChangeStdIn();
        // 時間計測
        var stopwatch = new Stopwatch();
        stopwatch.Start();
#endif
        // 出力高速化
        var streamWriter = new StreamWriter(Console.OpenStandardOutput()) {AutoFlush = false};
        Console.SetOut(streamWriter);
        // 回答
        Solve();
#if DEBUG
        stopwatch.Stop();
        Console.WriteLine(stopwatch.Elapsed);
#endif
        Console.Out.Flush();
    }

    static string ReadString() => Console.ReadLine().Trim();
    static int ReadInt() => int.Parse(ReadString());
    static long ReadLong() => long.Parse(ReadString());
    static float ReadFloat() => float.Parse(ReadString());
    static double ReadDouble => double.Parse(ReadString());

    static string[] ReadStringArray() => ReadString().Split(' ');
    static int[] ReadIntArray() => Array.ConvertAll(ReadString().Split(' '), int.Parse);
    static long[] ReadLongArray() => Array.ConvertAll(ReadString().Split(' '), long.Parse);
    static float[] ReadFloatArray() => Array.ConvertAll(ReadString().Split(' '), float.Parse);
    static double[] ReadDoubleArray() => Array.ConvertAll(ReadString().Split(' '), double.Parse);

    static T TypeConversion<T>(string s) {
        if (typeof(T) == typeof(int)) {
            return (T) Convert.ChangeType(int.Parse(s), typeof(T));
        } else if (typeof(T) == typeof(long)) {
            return (T) Convert.ChangeType(long.Parse(s), typeof(T));
        } else if (typeof(T) == typeof(double)) {
            return (T) Convert.ChangeType(double.Parse(s), typeof(T));
        } else {
            return (T) Convert.ChangeType(s, typeof(T));
        }
    }

    static void ReadMulti<T, U>(out T a, out U b) {
        var str = ReadStringArray();
        a = TypeConversion<T>(str[0]);
        b = TypeConversion<U>(str[1]);
    }

    static void ReadMulti<T, U, V>(out T a, out U b, out V c) {
        var str = ReadStringArray();
        a = TypeConversion<T>(str[0]);
        b = TypeConversion<U>(str[1]);
        c = TypeConversion<V>(str[2]);
    }

    static void WriteAnswer(object ans) => Console.WriteLine(ans);

    static bool IsOdd(long num) {
        return (num & 1) == 1;
    }

    static bool IsEven(long num) {
        return (num & 1) == 0;
    }
}

using System;
using System.Collections.Generic;

public class Test
{

    public static void Main()
    {
        int[] A = Array.ConvertAll(Console.ReadLine().Split(' '), m => Convert.ToInt32(m));

        var dis = A[0] - 1;

        var capacity = A[1];

        if(dis <= capacity)
        {
            Console.WriteLine(dis);
            return;
        }

        int extra = dis - capacity;

        int ans = capacity;

        int j = 2;
        while(extra-- > 0)
        {
            ans += j++;
        }

        Console.WriteLine(ans);

    }
}

using System;

namespace BasicProgramming
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] tokens = Console.ReadLine().Split();
            int n = int.Parse(tokens[0]);
            int v = int.Parse(tokens[1]);
            int i, litter, lastCity, pampNo;
            litter = n - 1;
            lastCity = v - 1;
            pampNo = litter - lastCity;
            if (litter > v)
            {
                i = 1;
                for (int m = 2; m <= pampNo; m++)
                {
                    i += m;
                }
                i += lastCity;
                Console.WriteLine(i);
            }
            else
            {
                Console.WriteLine(litter);
            }
        }
    }
}

namespace Problem
{
    using System;
    class Strop
    {
        static void Main()
        {
            string[] str = Console.ReadLine().Split();
            int n = int.Parse( str[0] );
            int v = int.Parse( str[1] );

            int soTien = v-1;
            int i = 1;
            while(n > v)
            {
                soTien += i;
                i++;
                n--;
            }
            Console.WriteLine( soTien );
        }
    }
}

using System;

namespace Sasha_Trip
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] entries = Array.ConvertAll(Console.ReadLine().Split(), int.Parse);

            int dolars = 0;

            if (entries[1] >= (entries[0] - 1))
            {
                dolars = (entries[1] == (entries[0] - 1)) ? entries[1] : entries[0];
            }
            else
            {
                int fuel = entries[1], lim = entries[0] - 1;
                dolars = entries[1];

                for (int i = 1; i < entries[0]; i++)
                {
                    if (fuel < entries[1])
                    {
                        fuel++;
                        dolars += i;
                    }
                    if (lim <= fuel)
                    {
                        break;
                    }
                    lim--;
                    fuel--;
                }
            }

            Console.WriteLine("{0}", dolars);
        }
    }
}

#region Usings
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;

using static System.Math;
#endregion

// https://codeforces.com/problemset/problem/1113/A
public class A___Sasha_and_His_Trip
{
    private static void Solve()
    {
        int n = ReadInt();
        int v = ReadInt();

        // Pre-load tank (v) for last cities
        int result = Min(n, v);

        // Keep tank at maximun in first (cheapest) cities
        for (int i = 2; i <= n - v; i++)
        {
            result += i;
        }

        Write(result);
    }

    #region Main

    private static TextReader reader;
    private static TextWriter writer;

    public static void Main()
    {
#if DEBUG

        //reader = new StreamReader("C:\\Users\\Axel\\Desktop\\input.txt");
        reader = new StreamReader(Console.OpenStandardInput());
        writer = Console.Out;

        //writer = new StreamWriter("..\\..\\output.txt");
#else
        reader = new StreamReader(Console.OpenStandardInput());
        writer = new StreamWriter(Console.OpenStandardOutput());

        //reader = new StreamReader("input.txt");
        //writer = new StreamWriter("output.txt");
#endif
        try
        {
            Solve();

            //var thread = new Thread(new String_Task().Solve, 1024 * 1024 * 128);
            //thread.Start();
            //thread.Join();
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
#if DEBUG
#else
            throw;
#endif
        }
        reader.Close();
        writer.Close();
    }

    #endregion Main

    #region Read / Write

    private static Queue<string> currentLineTokens = new Queue<string>();

    private static string[] ReadAndSplitLine()
    {
        return reader.ReadLine().Split(new[] { ' ', '\t', }, StringSplitOptions.RemoveEmptyEntries);
    }

    public static string Read()
    {
        while (currentLineTokens.Count == 0) currentLineTokens = new Queue<string>(ReadAndSplitLine()); return currentLineTokens.Dequeue();
    }

    public static int ReadInt()
    {
        return int.Parse(Read());
    }

    public static long ReadLong()
    {
        return long.Parse(Read());
    }

    public static double ReadDouble()
    {
        return double.Parse(Read(), CultureInfo.InvariantCulture);
    }

    public static int[] ReadIntArray()
    {
        return ReadAndSplitLine().Select(int.Parse).ToArray();
    }

    public static long[] ReadLongArray()
    {
        return ReadAndSplitLine().Select(long.Parse).ToArray();
    }

    public static double[] ReadDoubleArray()
    {
        return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();
    }

    public static int[][] ReadIntMatrix(int numberOfRows)
    {
        int[][] matrix = new int[numberOfRows][]; for (int i = 0; i < numberOfRows; i++) matrix[i] = ReadIntArray(); return matrix;
    }

    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows); int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++) { ret[i] = new int[numberOfRows]; for (int j = 0; j < numberOfRows; j++) ret[i][j] = matrix[j][i]; }
        return ret;
    }

    public static string[] ReadLines(int quantity)
    {
        string[] lines = new string[quantity]; for (int i = 0; i < quantity; i++) lines[i] = reader.ReadLine().Trim(); return lines;
    }

    public static void WriteArray<T>(IEnumerable<T> array)
    {
        writer.WriteLine(string.Join(" ", array));
    }

    public static void Write(params object[] array)
    {
        WriteArray(array);
    }

    public static void WriteLines<T>(IEnumerable<T> array)
    {
        foreach (var a in array) writer.WriteLine(a);
    }

    private class SDictionary<TKey, TValue> : Dictionary<TKey, TValue>
    {
        public new TValue this[TKey key]
        {
            get { return ContainsKey(key) ? base[key] : default(TValue); }
            set { base[key] = value; }
        }
    }

    private static T[] Init<T>(int size) where T : new()
    {
        var ret = new T[size]; for (int i = 0; i < size; i++) ret[i] = new T(); return ret;
    }

    #endregion Read / Write
}

using System;
using System.Collections.Generic;
using System.Linq;

namespace Codeforces
{
	class Program
	{
		static void Main(string[] args)
		{
			string input1 = Console.ReadLine();
			//string input2 = Console.ReadLine();

			//string input3 = Console.ReadLine();
			//string input4 = Console.ReadLine();

			var inputs1 = input1.Split(new[] { ' ', '}', '{' , ',' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();
			//var inputs2 = input2.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries).Select(long.Parse).ToArray();

			long n = inputs1[0];
			long v = inputs1[1];

			long sum = Math.Min(n, v);
			for (long i = 2; i <= n - v; i++)
			{
				sum += i;
			}

			Console.WriteLine(sum);
		}
	}
}

using System;

namespace ConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] input = Array.ConvertAll(Console.ReadLine().Split(' '), Int32.Parse);
            int minus = input[0] - input[1] - 1;
            if (minus <= 0)
            {
                Console.WriteLine(input[0] - 1);
            }
            else
            {
                Console.WriteLine(input[0] + (3 + minus + 1) * (minus - 1) / 2);
            }
        }
    }
}

using System;

namespace SimpleConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().ToString();
            var cities = Int32.Parse(input.Split(" ")[0].ToString());
            var fuelCapacity = Int32.Parse(input.Split(" ")[1]);

            var resultingAmount = 0;
            var fuelLevel = 1;

            for (int i = 0; i < cities; i++)
            {
                if(cities - fuelLevel  - i <= 0)
                {
                    break;
                }

                fuelLevel--;
               if (i == 0)
                {
                    resultingAmount += fuelCapacity > cities ? cities - 1: fuelCapacity ;
                    fuelLevel = fuelCapacity > cities ? cities : fuelCapacity;
                }
                else if (fuelLevel < fuelCapacity)
                {
                    resultingAmount += i + 1;
                    fuelLevel++;
                }
            }
            Console.Write(resultingAmount);
        }
    }
}

using System;

namespace SimpleConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            var input = Console.ReadLine().ToString();
            var cities = Int32.Parse(input.Split(" ")[0].ToString());
            var fuelCapacity = Int32.Parse(input.Split(" ")[1]);

            var resultingAmount = 0;
            var fuelLevel = 1;

            for (int i = 0; i < cities; i++)
            {
                if(cities - i - fuelLevel == 0)
                {
                    break;
                }

                fuelLevel--;
               if (i == 0)
                {
                    resultingAmount += fuelCapacity;
                    fuelLevel = fuelCapacity;
                }
                else if (fuelLevel < fuelCapacity)
                {
                    resultingAmount += i + 1;
                    fuelLevel++;
                }
            }
            Console.Write(resultingAmount);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace codeforces539
{
    class Program
    {
        static void Main(string[] args)
        {
            var sp = Console.ReadLine().Split().Select(x => int.Parse(x)).ToArray();

            int sol = 0;
            int v = 0;
            for(int i = 0; i < sp[0]; ++i, --v)
            {
                if (v >= sp[0] - i - 1)
                    break;
                sol += Math.Min(sp[0] - i, sp[1] - v) * (i + 1);
                v += Math.Min(sp[0] - i, sp[1] - v);
            }
            Console.WriteLine(sol);
        }
    }
}

using System;
using System.Linq;

namespace codeforces
{
    class Program
    {
        static void Main(string[] args)
        {
            int[] a = Console.ReadLine().Split().Select(int.Parse).ToArray();
            int rez = 0;
            if (a[1] >= a[0])
                rez = a[0];
            else
            {
                int c = a[0] - a[1];
                rez = a[1];
                for (int i = 2; i <= c; i++)
                    rez += i;
            }

            Console.WriteLine(rez);
        }
    }
}

using System;
using System.Linq;
using System.Collections.Generic;

static class UtilityMethods
{
	public static void Swap<T>(ref T a, ref T b)
	{
		T t = a;
		a = b;
		b = t;
	}

	public static int StrToInt(string s)
	{
		int number = 0;
		for (int i = s[0] == '-' ? 1 : 0; i < s.Length; i++)
			number = number * 10 + (s[i] - '0');
		return s[0] == '-' ? -number : number;
	}
	public static long StrToLong(string s)
	{
		long number = 0;
		for (int i = s[0] == '-' ? 1 : 0; i < s.Length; i++)
			number = number * 10 + (s[i] - '0');
		return s[0] == '-' ? -number : number;
	}

	public static string ReadString() => Console.ReadLine();
	public static int ReadInt() => StrToInt(ReadString());
	public static long ReadLong() => StrToLong(ReadString());
	public static double ReadDouble() => double.Parse(ReadString());

	public static string[] ReadStringArray() => ReadString().Split();
	public static int[] ReadIntArray() => Array.ConvertAll(ReadStringArray(), StrToInt);
	public static long[] ReadLongArray() => Array.ConvertAll(ReadStringArray(), StrToLong);
	public static double[] ReadDoubleArray() => ReadStringArray().Select(double.Parse).ToArray();

	public static void WriteLine(object a) => Console.WriteLine(a);
	public static void WriteLineArray<T>(string separator, T[] a, int startIndex, int count)
	{
		const int MAXLEN = 1000000;
		int len = 0, j = startIndex, lastIndex = startIndex + count;
		System.Text.StringBuilder str;
		string[] b = Array.ConvertAll(a, x => x.ToString());
		for (int i = startIndex; i < lastIndex - 1; i++)
		{
			len += b[i].Length + separator.Length;
			if (len >= MAXLEN)
			{
				str = new System.Text.StringBuilder(len);
				for (; j <= i; j++)
				{
					str.Append(b[j]);
					str.Append(separator);
				}
				Console.Write(str);
				len = 0;
			}
		}
		str = new System.Text.StringBuilder(len);
		for (; j < lastIndex - 1; j++)
		{
			str.Append(b[j]);
			str.Append(separator);
		}
		Console.Write(str);
		Console.WriteLine(b.Last());
	}
}

class Program
{
	static void Main()
	{
		int[] data = UtilityMethods.ReadIntArray();
		int n = data[0], v = data[1];
		int cost = 0, volume = 0;
		for (int i = 1; i <= n; i++)
			if (volume < n)
			{
				cost += Math.Min(v, n - volume - 1) * i;
				volume += Math.Min(v, n - volume);
			}
			else
				break;
		UtilityMethods.WriteLine(cost);
		Console.ReadLine();
	}
}

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO.Pipes;
using System.Linq;
using System.Numerics;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;

class Test
{

    static long MOD = 1000000007;
    static long[] fact = new long[500001];
    static long[] factInv = new long[500001];

    // Driver code
    public static void Main()
    {

        // int t = int.Parse(Console.ReadLine());
        // while (t > 0)
        {
            // t--;
            var input1 = Console.ReadLine().Split(' ').Select(xx => long.Parse(xx)).ToArray();
            var n = input1[0];
            var v = input1[1];
            if (n < v)
            {
                Console.WriteLine(n - 1);
            }
            else if(n==v)
            {
                Console.WriteLine(n);
            }
            else
            {
                var ans = v;

                for (int i = 2; i <= n - v; i++)
                {
                    ans = ans + i;
                }

                Console.WriteLine(ans);
            }

        }
    }

    public static long FastPower(long a, long b)
    {
        if (b == 0)
            return 1;

        var val = FastPower(a, b / 2);

        if (b % 2 == 0)
            return val * val % MOD;
        else
            return val * val % MOD * a % MOD;
    }

    public static void Fact()
    {
        fact[0] = 1;
        factInv[0] = FastPower(fact[0], MOD - 2);

        for (int i = 1; i <= 500000; i++)
        {
            fact[i] = i * fact[i - 1] % MOD;
            factInv[i] = FastPower(fact[i], MOD - 2);
        }

    }

    public static long NCR(long n, long r)
    {
        return fact[n] * factInv[r] % MOD * factInv[n - r] % MOD;
    }
}

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO.Pipes;
using System.Linq;
using System.Numerics;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;

class Test
{

    static long MOD = 1000000007;
    static long[] fact = new long[500001];
    static long[] factInv = new long[500001];

    // Driver code
    public static void Main()
    {

       // int t = int.Parse(Console.ReadLine());
       // while (t > 0)
        {
           // t--;
            var input1 = Console.ReadLine().Split(' ').Select(xx => long.Parse(xx)).ToArray();
            var n = input1[0];
            var v = input1[1];

            var ans = v;

            for(int i=2;i<=n-ans;i++)
            {
                ans = ans + i;
            }

            Console.WriteLine(ans);

        }
    }

    public static long FastPower(long a, long b)
    {
        if (b == 0)
            return 1;

        var val = FastPower(a, b / 2);

        if (b % 2 == 0)
            return val * val % MOD;
        else
            return val * val % MOD * a % MOD;
    }

    public static void Fact()
    {
        fact[0] = 1;
        factInv[0] = FastPower(fact[0], MOD - 2);

        for (int i = 1; i <= 500000; i++)
        {
            fact[i] = i * fact[i - 1] % MOD;
            factInv[i] = FastPower(fact[i], MOD - 2);
        }

    }

    public static long NCR(long n, long r)
    {
        return fact[n] * factInv[r] % MOD * factInv[n - r] % MOD;
    }
}

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO.Pipes;
using System.Linq;
using System.Numerics;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;

class Test
{

    static long MOD = 1000000007;
    static long[] fact = new long[500001];
    static long[] factInv = new long[500001];

    // Driver code
    public static void Main()
    {

        // int t = int.Parse(Console.ReadLine());
        // while (t > 0)
        {
            // t--;
            var input1 = Console.ReadLine().Split(' ').Select(xx => long.Parse(xx)).ToArray();
            var n = input1[0];
            var v = input1[1];
            if (n < v)
            {
                Console.WriteLine(n - 1);
            }
            else
            {
                var ans = v;

                for (int i = 2; i <= n - v; i++)
                {
                    ans = ans + i;
                }

                Console.WriteLine(ans);
            }

        }
    }

    public static long FastPower(long a, long b)
    {
        if (b == 0)
            return 1;

        var val = FastPower(a, b / 2);

        if (b % 2 == 0)
            return val * val % MOD;
        else
            return val * val % MOD * a % MOD;
    }

    public static void Fact()
    {
        fact[0] = 1;
        factInv[0] = FastPower(fact[0], MOD - 2);

        for (int i = 1; i <= 500000; i++)
        {
            fact[i] = i * fact[i - 1] % MOD;
            factInv[i] = FastPower(fact[i], MOD - 2);
        }

    }

    public static long NCR(long n, long r)
    {
        return fact[n] * factInv[r] % MOD * factInv[n - r] % MOD;
    }
}

using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO.Pipes;
using System.Linq;
using System.Numerics;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading;

class Test
{

    static long MOD = 1000000007;
    static long[] fact = new long[500001];
    static long[] factInv = new long[500001];

    // Driver code
    public static void Main()
    {

       // int t = int.Parse(Console.ReadLine());
       // while (t > 0)
        {
           // t--;
            var input1 = Console.ReadLine().Split(' ').Select(xx => long.Parse(xx)).ToArray();
            var n = input1[0];
            var v = input1[1];

            var ans = v;

            for(int i=2;i<=n-v;i++)
            {
                ans = ans + i;
            }

            Console.WriteLine(ans);

        }
    }

    public static long FastPower(long a, long b)
    {
        if (b == 0)
            return 1;

        var val = FastPower(a, b / 2);

        if (b % 2 == 0)
            return val * val % MOD;
        else
            return val * val % MOD * a % MOD;
    }

    public static void Fact()
    {
        fact[0] = 1;
        factInv[0] = FastPower(fact[0], MOD - 2);

        for (int i = 1; i <= 500000; i++)
        {
            fact[i] = i * fact[i - 1] % MOD;
            factInv[i] = FastPower(fact[i], MOD - 2);
        }

    }

    public static long NCR(long n, long r)
    {
        return fact[n] * factInv[r] % MOD * factInv[n - r] % MOD;
    }
}

using System;
using System.Collections;
using System.Collections.Generic;
class solution
{
    static void Main(string[] args)
    {
        string[] ab = Console.ReadLine().Split(' ');
        int n = Convert.ToInt32(ab[0]);
        int v = Convert.ToInt32(ab[1]);
        int current = 1, totalmoney = 0;
        while(current<n)
        {
            if(n-current>=v)
            {
                if (current == 1) totalmoney += v * current;
                else totalmoney += (v - 1) * current;
            }
            current++;
        }
        Console.Write(totalmoney);
    }
}

using System;
using System.Collections;
using System.Collections.Generic;
class solution
{
    static void Main(string[] args)
    {
        string[] ab = Console.ReadLine().Split(' ');
        int n = Convert.ToInt32(ab[0]);
        int v = Convert.ToInt32(ab[1]);
        int current = 1, totalmoney = 0;
        while(current<n)
        {
            if(n-current>=v)
            {
                if (current == 1) totalmoney += v * current;
                else totalmoney +=  current;
            }
            current++;
        }
        Console.Write(totalmoney);
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApplication1
{
    class A1113_SashaAndHisTrip
    {
        public static void Main()
        {
            string[] a = Console.ReadLine().Split(' ');
            int n = int.Parse(a[0]);
            int v = int.Parse(a[1]);
            int totalcost = v;
            int i = 2;
            n--;
            while(v<n)
            {
                v++;
                totalcost += i;
                i++;
            }
            Console.WriteLine(totalcost);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;

namespace Algorithms
{
    class Program
    {
        static void Main(string[] args)
        {
            var nAndv = Console.ReadLine().Split();
            var n = int.Parse(nAndv[0]);
            var v = int.Parse(nAndv[1]);
            var result = SashasTrip(n, v);

            Console.WriteLine(result);
        }

        private static int SashasTrip(int numberOfCities, int tankCapacity)
        {
            if (numberOfCities - 1 == tankCapacity)
                return tankCapacity;

            var totalLitresNeeded = numberOfCities - 1;

            int totalAmount = 0;

            int cityIndex = 1;
            while (totalLitresNeeded != 0)
            {
                if (totalLitresNeeded > tankCapacity)
                {
                    totalLitresNeeded -= tankCapacity;
                    totalAmount += cityIndex * tankCapacity;
                }
                else if (tankCapacity > totalLitresNeeded)
                {
                    totalAmount += cityIndex * totalLitresNeeded;
                    totalLitresNeeded = 0;
                }
                else
                {
                    totalAmount += cityIndex * tankCapacity;
                    totalLitresNeeded = 0;
                }

                cityIndex++;
            }

            return totalAmount;
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;

namespace Algorithms
{
    class Program
    {

        static void Main(string[] args)
        {
            var nAndv = Console.ReadLine().Split();
            var n = int.Parse(nAndv[0]);
            var v = int.Parse(nAndv[1]);
            var result = SashasTrip(n, v);

            Console.WriteLine(result);
        }

        private static int SashasTrip(int numberOfCities, int tankCapacity)
        {
            if (numberOfCities - 1 == tankCapacity)
                return tankCapacity;

            if (tankCapacity > numberOfCities)
                return numberOfCities;

            int totalAmount = 0;
            int cityIndex = 2;

            totalAmount += tankCapacity;
            numberOfCities--;

            while (numberOfCities-- != tankCapacity)
            {
                totalAmount += cityIndex;

                cityIndex++;
            }

            return totalAmount;
        }

    }
}

using System;
namespace Codeforces
{
    class Program
    {
        static void Main(string[] args)
        {

            string[] ab = Console.ReadLine().Split();
            int n = int.Parse(ab[0]);
            int v = int.Parse(ab[1]);

            if(v >= n - 1)
            {
                Console.WriteLine(v);
            }
            else
            {
                int i = 2;
                int liters = v ;
                int money = 1 * liters;
                while (i < n)
                {
                    liters--;
                    int c = v - liters;
                    liters += c;
                    money += c * i;
                    if(liters >= n - i)
                    {
                        break;
                    }
                    i++;
                }
            }

        }

        static int convertToInt(string n)
        {
            return int.Parse(n);
        }
    }
}

using System;
namespace Codeforces
{
    class Program
    {
        static void Main(string[] args)
        {

            string[] ab = Console.ReadLine().Split();
            int n = int.Parse(ab[0]);
            int v = int.Parse(ab[1]);

            if(v >= n - 1)
            {
                Console.WriteLine(v);
            }
            else
            {
                int i = 2;
                int liters = v ;
                int money = 1 * liters;
                while (i < n)
                {
                    liters--;
                    int c = v - liters;
                    liters += c;
                    money += c * i;
                    if(liters >= n - i)
                    {
                        break;
                    }
                    i++;
                }
                Console.WriteLine(money);
            }

        }

        static int convertToInt(string n)
        {
            return int.Parse(n);
        }
    }
}

using System;
using System.Linq;

namespace ConsoleApplication2
{
internal class Program
{
public static void Main(string[] args)
{
int[] array = Console.ReadLine().Split().Select(n => int.Parse(n)).ToArray();
int ans = 0;
if (array[1] >= array[0] - 1) ans = array[1];
else if (array[1] < array[0])
{
ans += array[1];
for (int i = 1; i <= array[0]; i++)
{
if (array[0] - i != array[1] - 1)
ans += i;
else
break;
}
}

Console.WriteLine(ans - 1);
}
}
}

//#define EXTENDSTACKSIZE

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;

namespace CF
{
    internal class Program
    {
        private const int stackSize = 64 * 1024 * 1024;

        private static void Run()
        {
            using (var sr = new InputReader(Console.In))
//            using (var sr = new InputReader(new StreamReader("input.txt")))
            using (var sw = Console.Out)
//            using (var sw = new StreamWriter("output.txt"))
            using (var task = new Task(sr, sw)) {
                task.Solve();
//                Console.ReadKey();
            }
        }

        private static void Main(string[] args)
        {
#if EXTENDSTACKSIZE
            var threadStart = new ThreadStart(Run);
            var thread = new Thread(threadStart, stackSize);
            thread.Start();
            thread.Join();
#else
            Run();
#endif
        }
    }

    internal class Task : IDisposable
    {
        private readonly InputReader sr;
        private readonly TextWriter sw;
        private bool isDispose;

        public Task(InputReader sr, TextWriter sw)
        {
            this.sr = sr;
            this.sw = sw;
        }

        public void Solve()
        {
            var n = sr.NextInt32();
            var v = sr.NextInt32();
            var currV = 0;
            var total = 0;
            for (var i = 1; i <= n; i++)
            {
                var need = n - i;
                currV--;

                if (need <= currV)
                {
                    sw.WriteLine(total);
                    return;
                }

                var d = need - currV;
                if (d <= v)
                {
                    total += (d * i);
                    sw.WriteLine(total);
                    return;
                }

                if (i == 1)
                {
                    total += v;
                    currV = v;
                }
                else
                {
                    total += i;
                    currV = v;
                }
            }

            throw new InvalidOperationException();
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        private void Dispose(bool disposing)
        {
            if (!isDispose) {
                if (disposing) {
                    if(sr != null)
                        sr.Dispose();

                    if(sw != null)
                        sw.Dispose();
                }

                isDispose = true;
            }
        }
    }
}

class Pair
{
    public long Value { get; set; }
    public int Count { get; set; }
}

class PairComparer : Comparer<Pair>
{
    public override int Compare(Pair x, Pair y)
    {
        return x.Value.CompareTo(y.Value);
    }
}

internal class InputReader : IDisposable
{
    private bool isDispose;
    private readonly TextReader sr;
    private string[] buffer;
    private int seek;

    public InputReader(TextReader stream)
    {
        sr = stream;
    }

    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    public string NextString()
    {
        var result = sr.ReadLine();
        return result;
    }

    public int NextInt32()
    {
        return Int32.Parse(ReadNextToken());
    }

    private string ReadNextToken()
    {
        if (buffer == null || seek == buffer.Length) {
            seek = 0;
            buffer = NextSplitStrings();
        }

        return buffer[seek++];
    }

    public long NextInt64()
    {
        return Int64.Parse(ReadNextToken());
    }

    public int[] ReadArrayOfInt32()
    {
        return ReadArray(Int32.Parse);
    }

    public long[] ReadArrayOfInt64()
    {
        return ReadArray(Int64.Parse);
    }

    public string[] NextSplitStrings()
    {
        return NextString()
            .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
    {
        return NextSplitStrings()
            .Select(s => func(s, CultureInfo.InvariantCulture))
            .ToArray();
    }

    public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
    {
        return
            str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(s => func(s, CultureInfo.InvariantCulture))
                .ToArray();
    }

    protected void Dispose(bool dispose)
    {
        if (!isDispose)
        {
            if (dispose)
                sr.Close();

            isDispose = true;
        }
    }

    ~InputReader()
    {
        Dispose(false);
    }
}

//#define EXTENDSTACKSIZE

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading;

namespace CF
{
    internal class Program
    {
        private const int stackSize = 64 * 1024 * 1024;

        private static void Run()
        {
            using (var sr = new InputReader(Console.In))
//            using (var sr = new InputReader(new StreamReader("input.txt")))
            using (var sw = Console.Out)
//            using (var sw = new StreamWriter("output.txt"))
            using (var task = new Task(sr, sw)) {
                task.Solve();
//                Console.ReadKey();
            }
        }

        private static void Main(string[] args)
        {
#if EXTENDSTACKSIZE
            var threadStart = new ThreadStart(Run);
            var thread = new Thread(threadStart, stackSize);
            thread.Start();
            thread.Join();
#else
            Run();
#endif
        }
    }

    internal class Task : IDisposable
    {
        private readonly InputReader sr;
        private readonly TextWriter sw;
        private bool isDispose;

        public Task(InputReader sr, TextWriter sw)
        {
            this.sr = sr;
            this.sw = sw;
        }

        public void Solve()
        {
            var n = sr.NextInt32();
            var v = sr.NextInt32();
            var currV = 0;
            var total = 0;
            for (var i = 1; i <= n; i++)
            {
                var need = n - i;
                if (i > 1)
                {
                    currV--;
                }

                if (need <= currV)
                {
                    sw.WriteLine(total);
                    return;
                }

                var d = need - currV;
                if (d <= v)
                {
                    total += (d * i);
                    sw.WriteLine(total);
                    return;
                }

                if (i == 1)
                {
                    total += v;
                    currV = v;
                }
                else
                {
                    total += i;
                    currV = v;
                }
            }

            throw new InvalidOperationException();
        }

        public void Dispose()
        {
            Dispose(true);
            GC.SuppressFinalize(this);
        }

        private void Dispose(bool disposing)
        {
            if (!isDispose) {
                if (disposing) {
                    if(sr != null)
                        sr.Dispose();

                    if(sw != null)
                        sw.Dispose();
                }

                isDispose = true;
            }
        }
    }
}

class Pair
{
    public long Value { get; set; }
    public int Count { get; set; }
}

class PairComparer : Comparer<Pair>
{
    public override int Compare(Pair x, Pair y)
    {
        return x.Value.CompareTo(y.Value);
    }
}

internal class InputReader : IDisposable
{
    private bool isDispose;
    private readonly TextReader sr;
    private string[] buffer;
    private int seek;

    public InputReader(TextReader stream)
    {
        sr = stream;
    }

    public void Dispose()
    {
        Dispose(true);
        GC.SuppressFinalize(this);
    }

    public string NextString()
    {
        var result = sr.ReadLine();
        return result;
    }

    public int NextInt32()
    {
        return Int32.Parse(ReadNextToken());
    }

    private string ReadNextToken()
    {
        if (buffer == null || seek == buffer.Length) {
            seek = 0;
            buffer = NextSplitStrings();
        }

        return buffer[seek++];
    }

    public long NextInt64()
    {
        return Int64.Parse(ReadNextToken());
    }

    public int[] ReadArrayOfInt32()
    {
        return ReadArray(Int32.Parse);
    }

    public long[] ReadArrayOfInt64()
    {
        return ReadArray(Int64.Parse);
    }

    public string[] NextSplitStrings()
    {
        return NextString()
            .Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public T[] ReadArray<T>(Func<string, CultureInfo, T> func)
    {
        return NextSplitStrings()
            .Select(s => func(s, CultureInfo.InvariantCulture))
            .ToArray();
    }

    public T[] ReadArrayFromString<T>(Func<string, CultureInfo, T> func, string str)
    {
        return
            str.Split(new[] { ' ' }, StringSplitOptions.RemoveEmptyEntries)
                .Select(s => func(s, CultureInfo.InvariantCulture))
                .ToArray();
    }

    protected void Dispose(bool dispose)
    {
        if (!isDispose)
        {
            if (dispose)
                sr.Close();

            isDispose = true;
        }
    }

    ~InputReader()
    {
        Dispose(false);
    }
}

using System;
class Codeforces_Round_539_A
{
  static void Main()
  {
    string [] s = Console.ReadLine().Split(' ');
    int n = Convert.ToInt32(s[0]);
    int v = Convert.ToInt32(s[1]);
    int [] a = new int [n];
    int i = 0; int t = n-1; int coin = 0;
    for(; i<n; i++)
    {
        a[i] = i+1;
    }
    if(v == t) coin = v * a[0];
    if(v > t) coin = t;
    if(v < t)
    {
        int tb = v; coin = v * a[0];
        for(int k=1; k<n-1; k++)
        {
            tb--;
            while(tb<v)
            {
                tb++;
                coin = coin+a[k];
            }
            if(tb == a[k])
            break;
        }
    }
    Console.Write(coin);
  }
}

using System;
class Codeforces_Round_539_A
{
  static void Main()
  {
    string [] s = Console.ReadLine().Split(' ');
    int n = Convert.ToInt32(s[0]);
    int v = Convert.ToInt32(s[1]);
    int [] a = new int [n];
    int i = 0; int t = n-1; int coin = 0;
    for(; i<n; i++)
    {
        a[i] = i+1;
    }
    if(v == t) coin = v * a[0];
    if(v > t) coin = t;
    if(v < t)
    {
        int tb = v; coin = v * a[0];
        for(int k=1; k<n; k++)
        {
            tb--;
            while(tb<v)
            {
                tb++;
                coin = coin+a[k];
            }
            if(tb == a[k])
            break;
        }
    }
    Console.Write(coin);
  }
}

using System;
namespace BasicProgramming
{
    class Program
    {
        static void Main(string[] args)
        {

            string[] tokens = Console.ReadLine().Split();
            int n = int.Parse(tokens[0]);
            int v = int.Parse(tokens[1]);
            int i=0,litter,lastCity,mNo;
            litter = n - 1;
            lastCity = v - 1;
            mNo = litter - lastCity;
            if (litter == v)
            {
                i = v;
                Console.WriteLine(i);
            }
            else if (litter > v)
            {
                i = 1;
                for (int m = 2; m <= mNo; m++)
                {
                        i += m;
                }
                i += lastCity;
                Console.WriteLine(i);
            }

        }
    }
}

namespace Problem
{
    using System;
    #region GIFT
    class Gift
    {
        void Main()
        {
            int n = int.Parse( Console.ReadLine() );
            int[] a = new int[n];
            for(int t = 0 ; t < n ; t++)
            {
                a[t] = int.Parse( Console.ReadLine() );
            }
            int i=0;
            int dem = 1;
            int max = dem;
            while(i < n-1)
            {
                if(a[i] < a[i + 1])
                {
                    dem++;
                    if(i == n - 2)
                        max = max > dem ? max : dem;
                }
                else
                {
                    max = max > dem ? max : dem;
                    dem = 1;
                }
                i++;
            }
            Console.WriteLine( max );
        }
    }
    #endregion
    class Strop
    {
        static void Main()
        {
            string[] str = Console.ReadLine().Split();
            int n = int.Parse( str[0] );
            int v = int.Parse( str[1] );

            int soTien = v-1;
            int i = 1;
            while(n > v)
            {
                soTien += i;
                i++;
                n--;
            }
            Console.WriteLine( soTien );
        }
    }
}