#include <bits/stdc++.h>
using namespace std;
long long MAX = 9223372036854775800;
unsigned long long val(int n, int k) {
  unsigned long long num = 1;
  for (int i = 0; i < k; i++) {
    num *= (n - i);
  }
  for (int i = 1; i <= k; i++) {
    num /= i;
  }
  if (k == 3) {
    num *= 2;
  } else if (k == 4) {
    num *= 9;
  }
  return num;
}
int main() {
  unsigned long long n, k;
  cin >> n >> k;
  unsigned long long count = 0;
  for (int i = 0; i <= k; i++) {
    if (i == 0)
      count++;
    else if (i == 1)
      continue;
    else {
      count += val(n, i);
    }
  }
  cout << count;
  return 0;
}
