#include <bits/stdc++.h>
using namespace std;
long long int ncr(long long int n, long long int r) {
  long long int ret = 1;
  for (long long int i = n; i > n - r; i--) ret *= i;
  for (long long int i = 1; i <= r; i++) ret /= i;
  return ret;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int TESTS = 1;
  while (TESTS--) {
    long long int n, k;
    cin >> n >> k;
    long long int d[] = {1, 0, 1, 2, 9};
    long long int ans = 0;
    for (long long int i = 0; i <= k; i++) {
      ans += d[i] * ncr(n, i);
    }
    cout << ans;
  }
  return 0;
}
