#include <bits/stdc++.h>
using namespace std;
int fm(int k) {
  int sum = 1;
  for (int i = 1; i <= k; ++i) {
    sum *= i;
  }
  return sum;
}
int main() {
  string n;
  int m;
  cin >> n;
  cin >> m;
  int keta = n.length();
  cout << fm(keta) / fm(keta - m) << endl;
  return 0;
}
