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
import sys
input = sys.stdin.readline

'''

'''

def fast_factorial(mod=None):
    """
    Faster than naive factorial, uses memoization.
    """
    res = [1,1]
    size = 2

    def ff(k):
        nonlocal size

        while k >= size:
            res.append(res[-1] * size)
            size += 1  
        return res[k]
    
    def ff_mod(k):
        nonlocal size

        while k >= size:
            res.append((res[-1] * (size % mod)) % mod)
            size += 1
        
        return res[k]

    if mod == None:
        return ff
    else:
        return ff_mod

ff = fast_factorial()

def nCk(n, k):
    return ff(n) // (ff(k) * ff(n-k))

n, k = map(int, input().split())

def remain(n):
    nums = [-1] * n
    res = 0

    def solve(i):
        nonlocal nums, res

        if i == n:
            #print(nums)
            res += 1
            return 

        for j in range(n):
            if i != j and not(j in nums):
                nums[i] = j
                solve(i+1)
                nums[i] = -1  

    solve(0)
    return res  

#remain(4)

res = 1
for c in range(n-k, n-1):
    num = nCk(n, c) * remain(n-c)
    res += num
print(res)
