from math import factorial as f g=int(input()) n=int(input()) m=(g%(n*1000))//1000 print(f(n)//(f(m)*f(n-m)))