// Compute C(m,n) for user-specified m and n 	
	
import java.io.*;	
	
public class Combination{	
	// main(): application entry point	
	public static void main(String[] args) throws IOException {	
		// set input stream	
		BufferedReader stdin = new BufferedReader(	
				new InputStreamReader( System.in ) );	
	
		// prompt and extract user inputs	
		System.out.print("Enter number of distinct objects");	
		int m = Integer.parseInt( stdin.readLine() );	
		System.out.print("Enter desired subset size");	
		int n = Integer.parseInt( stdin.readLine() );	
	
		// compute the three needed factorials	
		int mFactorial = 1;	
		for (int i = 2; i <= m; ++i) {	
			mFactorial *= i;	
		}	
	
		int nFactorial = 1;	
		for (int i = 2; i <= n; ++i) {	
			nFactorial *= i;	
		}	
	
		int mDiffNFactorial = 1;	
		for (int i = 2; i <= m - n; ++i) {	
			mDiffNFactorial *= i;	
		}	
	
		// compute and displays combinations	
		int combinations = mFactorial	
			/ (nFactorial * mDiffNFactorial);	
	
		System.out.println("We can make " + combinations	
			+ " different combinations when choosing " + n 	
			+ " objects from " + m + " different objects");	
	}	
}	
	
