#include <stdio.h>
int count(double n, double m){
double i, s=n;
for(i=(n-1);i>m;i--)
s *= i;
for(i=(n-m);i>1;i--)
s /= i;
return (int)s;
}
int main(){
int n, m, d;
while(scanf("%d %d", &n, &m) != EOF){
if(n==0)
break;
if(m==0 || n==m){
printf("1\n");
continue;
}
if(m==1){
printf("%d\n", n);
continue;
}
d = n-m;
if(m>d)
printf("%d\n", count((double)n, (double)m));
else
printf("%d\n", count((double)n, (double)d));
}
return 0;
}