// Arup Guha
// 11/16/2017
// Solution to 2017 SER D1 Problem: Exciting Finish!

import java.util.*;

public class exciting {

	public static int n;
	public static int points;
	public static int[] curScore;
	public static int[][][] memo;

	public static void main(String[] args) {

		// Read the input.
		Scanner stdin = new Scanner(System.in);
		n = stdin.nextInt();
		points = stdin.nextInt();
		curScore = new int[n];
		for (int i=0; i<n; i++)
			curScore[i] = stdin.nextInt();

		// Sort just so we know where the current max is...
		Arrays.sort(curScore);

		// Set up memo table.
		memo = new int[n][1<<n][points+1];
		for (int i=0; i<n; i++)
			for (int j=0; j<(1<<n); j++)
				Arrays.fill(memo[i][j], -1);

		// Do it!
		System.out.println(go(n-1, 0, points));
	}

	public static int go(int last, int mask, int ptsLeft) {

		// All of our base cases.
		if (n == 1) return 0;
		if (ptsLeft < 0) return 0;
		if (mask == ((1<<n)-1)) return 1;
		if (memo[last][mask][ptsLeft] != -1) return memo[last][mask][ptsLeft];

		// Number of candidates not yet scored.
		int off = n - Integer.bitCount(mask);

		int res = 0;

		// Try each person next.
		for (int i=0; i<n; i++) {

			// Not allowed.
			if (i == last) continue;

			// We can choose person i next.
			if ((mask & (1<<i)) == 0) {

				// Extra points to put this person in the lead.
				int toLead = curScore[last] - curScore[i] + 1;

				// They already have their necessary points.
				if (toLead <= 0)
					res += go(i, mask | (1<<i), ptsLeft);

				// Add these points to all people yet to be placed.
				else
					res += go (i, mask | (1<<i), ptsLeft-off*toLead);
			}
		}

		// Store and return.
		return memo[last][mask][ptsLeft] = res;
	}
}