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 queue
from math import inf, gcd, floor, sqrt, ceil, log, log2, log10, factorial
import sys
from collections import *
from random import *
import itertools

sys.setrecursionlimit(99999)
#sys.stdin = open("input.txt", 'r') # for debug purpose
eps = sys.float_info.epsilon
P = 2
INF = 1e9 + 1
MOD = 998244353


def is_prime(n):
    if n == 0 or n == 1:
        return False
    d = 2
    while d * d <= n:
        if n % d == 0:
            return False
        d += 1
    return True


def div_up(n, k):
    if n % k == 0:
        return n // k
    else:
        return n // k + 1


def num_len(n, base=10):
    if n == 0:
        return 1
    res = 0
    while n > 0:
        res += 1
        n //= 10
    return res


def down(a):
    for i in range(1, len(a)):
        if a[i] > a[i - 1]:
            return False
    return True


def up(a):
    for i in range(1, len(a)):
        if a[i] < a[i - 1]:
            return False
    return True


def code(c):
    return ord(c) - 32


def _hash_(s):
    res, p = 0, 1
    for i in range(len(s)):
        res += (code(s[i]) * p)
        res %= MOD
        p *= P
        p %= MOD
    return res % MOD


def remove_edge(v, u, graph):
    graph[v].remove(u)
    graph[u].remove(v)


def all_eq(a):
    for i in range(len(a) - 1):
        if a[i] != a[i + 1]:
            return False
    return True


def kmp(s, pr):
    n = len(s)
    pr[0] = 0
    for i in range(1, n):
        j = pr[i - 1]
        while j > 0 and s[i] != s[j]:
            j = pr[j - 1]
        if s[i] == s[j]:
            j += 1
        pr[i] = j


def lcm(a, b):
    return a * b // gcd(a, b)


def gcd_advanced(a, b):
    if a == 0:
        return 0, 1, b
    x1, y1, g = gcd_advanced(b % a, a)
    return y1 - x1 * (b // a), x1, g


def lowest(s):
    res = 0
    ret = ''
    while res + 9 <= s:
        res += 9
        ret += '9'
    if res == s:
        return ret
    return str(s - res) + ret


def C(k, n):
    res = 1
    for i in range(n - k + 1, n + 1):
        res *= i
    for i in range(1, k + 1):
        res //= i
    return res


def d(n):
    if n == 1:
        return 0
    if n == 2:
        return 1
    return (n - 1) * (d(n - 2) + d(n - 1))


def solve():
    n, k = map(int, input().split())
    k = n - k
    res = 1
    for i in range(k, n - 1):
        res += C(i, n) * d(n - i)
    print(res)
# 1 2 4 3
# 1 _ 3 _ _

#for _ in range(int(input())):
solve()


def debug():
    pass


#debug()