#include <bits/stdc++.h>
using namespace std;
const int MX = 1 * 1e5 + 100;
const long long INF = 1e18;
int N, M, k;
int arr[MX];
int cnt[33];
char s[MX];
long long nCk(long long n, long long k) {
  long long ans = 1;
  int kk = 0;
  while (kk != k) {
    ans = ans * (n - kk);
    kk++;
  }
  long long dd = 1;
  for (int i = 1; i <= k; i++) dd *= i;
  return (long long)ans / dd;
}
long long fact(long long n) {
  if (n == 3) return 2;
  if (n == 4) return 9;
  return 1;
}
int main() {
  cin >> N >> k;
  if (k == 1) {
    cout << 1;
  } else if (1) {
    long long ans = 0;
    while (k > 1) {
      ans += nCk(N, k) * fact(k);
      k--;
    }
    cout << ++ans;
  }
  return 0;
}
