#include <bits/stdc++.h>
using namespace std;
const int maxn = 3 * 100000 + 10;
int a[maxn];
long long c(long long a, long long b) {
  if (b == 0) return 1;
  if (a - b < b) b = a - b;
  long long sum1 = 1;
  for (int i = a; i > a - b; i--) {
    sum1 = sum1 * i;
  }
  long long sum2 = 1;
  for (int i = b; i >= 1; i--) {
    sum2 = sum2 * i;
  }
  return sum1 / sum2;
}
int main() {
  ios::sync_with_stdio(false);
  int n, k;
  cin >> n >> k;
  long long ans = 0;
  a[1] = 0;
  a[2] = 1;
  a[3] = 2;
  a[4] = 9;
  for (int i = 1; i <= k; i++) {
    ans += c(n, i) * a[i];
  }
  ans++;
  cout << ans << endl;
  return 0;
}
