import java.io.*; import java.util.Scanner; public class Main_yukicoder821 { private static Scanner sc; private static Printer pr; private static void solve() { long n = sc.nextInt(); long k = sc.nextInt(); long max = n * (n + 1) / 2; long min = n * (n + 1) / 2 - (n - k) * (n - k + 1) / 2 * 2; pr.println((max + min + 1 + 1) / 2) ; } // --------------------------------------------------- public static void main(String[] args) { sc = new Scanner(System.in); pr = new Printer(System.out); solve(); pr.close(); sc.close(); } static class Printer extends PrintWriter { Printer(OutputStream out) { super(out); } } }