Code golf: Distributing the balls (I) Challenge


  In this task you have compute the number of  ways we can
  distribute A balls into B
  cells with with every cell
  having at-least one ball.


The inputs A and B are given in a single line separated by a blank,the inputs are terminated by EOF.

You may like to check your solutions here.

Input

0 0
1 0
12 4
6 3
18 17
20 19
15 13
18 9
20 20
17 14
9 2
14 13
18 11


Output

1
0
14676024
540
54420176498688000
23112569077678080000
28332944640000
38528927611574400
2432902008176640000
21785854970880000
510
566658892800
334942064711654400


Constraints


Every A and B can be distinguishable.
0 &lt;= A,B &lt;= 20
You can use any language of your choice
Shortest solution wins!
JavaScript (90 93)

function f(a,b){n=m=r=1;for(i=b;i&gt;0;n*=-1){r+=n*m*Math.pow(i,a);m=m*i/(b-i--+1)}return--r}


http://jsfiddle.net/RDGUn/2/

Obviously, any math-based language such as APL will beat me because of syntax verbosity and lack of built-in mathematical constructs :)

Edit Also, I don't have any input-related functionality  except parameters passed into the function, not sure how to use standard input with JavaScript...

Edit: Move i-- into m=m* expression; move n*=-1 into for; start r=1 to  combine assignments and remove extraneous one on return. (save 3 chars)