A permutation *p* of size *n* is an array such that every integer from 1 to *n* occurs exactly once in this array.

Let's call a permutation an almost identity permutation iff there exist at least *n* - *k* indices *i* (1 ≤ *i* ≤ *n*) such that *p*<sub class="lower-index">*i*</sub> = *i*.

Your task is to count the number of almost identity permutations for given numbers *n* and *k*.
The first line contains two integers *n* and *k* (4 ≤ *n* ≤ 1000, 1 ≤ *k* ≤ 4).
none
4 1
1
4 2
7
5 3
31
5 4
76
200 1
1
200 2
19901
200 3
2646701
200 4
584811251
400 1
1
400 2
79801
400 3
21253401
400 4
9477912501
600 1
1
600 2
179701
600 3
71820101
600 4
48187303751
800 1
1
800 2
319601
800 3
170346801
800 4
152620985001
1000 1
1
1000 2
499501
1000 3
332833501
1000 4
373086956251
4 4
24
## Fast I/O
import io,os,sys

# Fast input. Use s = input().decode() for strings
# input = io.BytesIO(os.read(0,os.fstat(0).st_size)).readline

# Fast output
def print(*args, sep = ' ', end = '\n'):
    string = sep.join(map(str, args))+end
    sys.stdout.write(string)

def debug(*args, sep = ' ', end = '\n'):
    string = "Debug: " + sep.join(map(str, args)) + end
    sys.stderr.write(string)

# from collections import Counter, defaultdict
# from functools import lru_cache
# from math import floor, ceil, sqrt, gcd
# from sys import stderr

def facto(n):
    if n <= 1:
        return 1
    return n * facto(n-1)

def D(n):
    if n == 0:
        return 1
    elif n&1:
        return n * D(n - 1) - 1
    return n * D(n - 1) + 1

def A(k, n):
    # Number of arrangments for a small k
    r = 1
    for i in range(n, n-k, -1):
        r *= i
    return r

def binom(k, n):
    # n choose k for a small k
    return A(k, n) // facto(k)

def exact(k, n):
    return D(k) * binom(k, n)

N, K = map(int, input().split())
ans = 0
for k in range(K+1):
    ans += exact(k, N)
print(ans)


#
#   @PoustouFlan
#   Code:Choke?!
#    [  极客  ]
#
