#include <bits/stdc++.h>
#pragma GCC optimize(2)
#pragma comment(linker, "/STACK:10240000,10240000")
using namespace std;
const long long P = 1e9 + 7;
long long mul(long long a, long long b) {
  long long ans = 0;
  for (; b; a = a * 2 % P, b >>= 1)
    if (b & 1) ans = (ans + a) % P;
  return ans;
}
long long qpow(long long a, long long n) {
  long long r = 1 % P;
  for (a %= P; n; a = a * a % P, n >>= 1)
    if (n & 1) r = r * a % P;
  return r;
}
const int maxn = 1e5 + 5;
const int maxm = 1e6 + 5;
int n;
long long fac[2010], inv[2010];
long long comb(int x, int y) {
  long long ans = 1;
  for (int i = 1; i <= y; i++) {
    ans *= x;
    ans /= i;
    x--;
  }
  return ans;
}
int g[5] = {0, 0, 1, 2, 9};
signed main() {
  fac[0] = inv[0] = 1;
  for (int i = 1; i <= 2000; i++) {
    fac[i] = fac[i - 1] * i;
    inv[i] = qpow(fac[i], P - 2);
  }
  int n, k;
  cin >> n >> k;
  long long ans = 0;
  for (int i = 1; i <= k; i++) ans += comb(n, i) * g[i];
  ans++;
  cout << ans;
}
