using System;
public class Program
{
public static void Main()
int[] vl = {1,4,5,7,9,8};
int w = 9;
Console.WriteLine(NS(vl, w, vl.Length));
int n = vl.Length;
}
public static int NS(int[] vl, int w, int n){
if(w == 0) {
return 1;
if(n == 0){
return 0;
else if(vl[n-1]<=w){
return (NS(vl, w-vl[n-1], n-1) + NS(vl, w, n-1));
else if(vl[n-1]>w) {
return NS(vl, w, n-1);