#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k;
  cin >> n >> k;
  vector<long long> v = {1, 0, 1, 2, 9};
  long long ans = 0;
  for (long long i = k; i >= 0; i--) {
    long long tem = i;
    long long te = n;
    long long res = 1;
    while (tem--) {
      res *= te;
      res /= (i - tem);
      te--;
    }
    res *= v[i];
    ans += res;
  }
  cout << ans << endl;
}
