It is a balmy spring afternoon, and Farmer John's *n* cows are ruminating about link-cut cacti in their stalls. The cows, labeled 1 through *n*, are arranged so that the *i*-th cow occupies the *i*-th stall from the left. However, Elsie, after realizing that she will forever live in the shadows beyond Bessie's limelight, has formed the Mischievous Mess Makers and is plotting to disrupt this beautiful pastoral rhythm. While Farmer John takes his *k* minute long nap, Elsie and the Mess Makers plan to repeatedly choose two distinct stalls and swap the cows occupying those stalls, making no more than one swap each minute.

Being the meticulous pranksters that they are, the Mischievous Mess Makers would like to know the maximum messiness attainable in the *k* minutes that they have. We denote as *p*<sub class="lower-index">*i*</sub> the label of the cow in the *i*-th stall. The messiness of an arrangement of cows is defined as the number of pairs (*i*, *j*) such that *i* &lt; *j* and *p*<sub class="lower-index">*i*</sub> &gt; *p*<sub class="lower-index">*j*</sub>.
The first line of the input contains two integers *n* and *k* (1 ≤ *n*, *k* ≤ 100 000) — the number of cows and the length of Farmer John's nap, respectively.
In the first sample, the Mischievous Mess Makers can swap the cows in the stalls 1 and 5 during the first minute, then the cows in stalls 2 and 4 during the second minute. This reverses the arrangement of cows, giving us a total messiness of 10.

In the second sample, there is only one cow, so the maximum possible messiness is 0.
5 2
10
1 10
0
100000 2
399990
1 1
0
8 3
27
7 1
11
100000 40000
4799960000
1 1000
0
100 45
4905
9 2
26
456 78
58890
100000 50000
4999950000
100000 50001
4999950000
100000 50002
4999950000
100000 50003
4999950000
100000 49998
4999949994
100000 49997
4999949985
99999 49998
4999849998
99999 49997
4999849991
99999 49996
4999849980
99999 50000
4999850001
99999 50001
4999850001
99999 50002
4999850001
30062 9
540945
13486 3
80895
29614 7
414491
13038 8
208472
96462 6
1157466
22599 93799
255346101
421 36817
88410
72859 65869
2654180511
37916 5241
342494109
47066 12852
879423804
84032 21951
2725458111
70454 75240
2481847831
86946 63967
3779759985
71128 11076
1330260828
46111 64940
1063089105
46111 64940
1063089105
56500 84184
1596096750
60108 83701
1806455778
1 2
0
1 3
0
1 4
0
1 5
0
1 6
0
2 1
1
2 2
1
2 3
1
2 4
1
2 5
1
3 1
3
3 2
3
3 3
3
3 4
3
3 5
3
4 1
5
4 2
6
4 3
6
4 4
6
4 5
6
5 1
7
5 3
10
5 4
10
5 5
10
6 1
9
6 2
14
6 3
15
7 2
18
7 3
21
7 4
21
10 2
30
60982 2
243918
23426 23
1076515
444 3
2643
18187 433
15374531
6895 3544
23767065
56204 22352
1513297456
41977 5207
382917573
78147 2321
351981971
99742 62198
4974183411
72099 38339
2599096851
82532 4838
751762306
79410 33144
3066847464
11021 3389
51726307
66900 7572
898455660
99999 49999
4999850001
100000 49999
4999949999
100000 100000
4999950000
100000 1
199997
4 100
6
100000 1234
243753254
#[int(i) for i in input().split()]
n, k = [int(i) for i in input().split()]
i = 0
res = 0
for j in range(min(n // 2, k)):
    res += n - j - 1 - j
    res += n - 2 - j - j
print(res)
