from math import factorial as f N, K = map(int, input().split()) ans, rem = 0, N - K for L in range(0, rem + 1): if L > 1 or K > 1: ans += f(rem) // f(L) // f(rem - L) print(ans)