/* package whatever; // don't place package name! */

import java.util.*;
import java.lang.*;
import java.io.*;
import java.util.*;

/* Name of the class has to be "Main" only if the class is public. */
class Ideone
{
	
	private static Map<Params, List<List<Integer>>> memo = new HashMap<>();
	
	List<List<Integer>> sodaPacks(int[] packs, int n, int i) {
	  Params params = new Params(n, i);
	  if (memo.containsKey(params)) {
	    return memo.get(params);
	  }	
	  List<List<Integer>> result = new ArrayList<>();
	  
	  // Base case: we have one way to make an empty list
	  if (n == 0) {
	  	result.add(new ArrayList<>());
	  	return result;
	  }
	  
	  // Recursive step: we solve a smaller problem
	  // For each coin, you either include it or exclude it
	  // Include it:
	  if (n - packs[i] >= 0) {
		  List<List<Integer>> include = sodaPacks(packs, n - packs[i], i);
		  // If we include it, we must tack it on:
		  for (List<Integer> list : include) {
	        // Tack on our solution:
	        list.add(packs[i]);
	        result.add(list);
	      }
	  }
	  // Exclude it:
	  if (i + 1 < packs.length) {
		  List<List<Integer>> exclude = sodaPacks(packs, n, i + 1);
		  result.addAll(exclude);
	  }
	  memo.put(params, new ArrayList<>(result));
	  return result;
	}
	
	static class Params {
		int n, i;
		public Params(int n, int i) {
			this.n = n;
			this.i = i;
		}
		@Override
		public int hashCode() {
			return n * 13 + i;
		}
		
		@Override
		public boolean equals(Object o) {
		  if(o == null) return false;
    	  if(!(o instanceof Params)) return false;
    	  
    	  Params other = (Params) o;
    	  return this.n == other.n && this.i == other.i;
		}
	}

	public static void main (String[] args) throws java.lang.Exception
	{
		Scanner sc = new Scanner(System.in);
		int n = sc.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) {
			a[i] = sc.nextInt();
		}
		int sodas = sc.nextInt();
		Ideone solution = new Ideone();
		System.out.println(solution.sodaPacks(a, sodas, 0));
		sc.close();
	}
}