import java.util.*; public class Main { static final int MOD = 1000000007; public static void main (String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int k = sc.nextInt(); TreeMap map = new TreeMap<>(); map.put(0, 1); for (int i = 0; i < n; i++) { int x = sc.nextInt() - k; if (x >= 0) { Integer key = Integer.MAX_VALUE; while ((key = map.lowerKey(key)) != null) { int next = key + x; if (map.containsKey(next)) { map.put(next, (map.get(next) + map.get(key)) % MOD); } else { map.put(next, map.get(key)); } } } else { Integer key = Integer.MIN_VALUE; while ((key = map.higherKey(key)) != null) { int next = key + x; if (map.containsKey(next)) { map.put(next, (map.get(next) + map.get(key)) % MOD); } else { map.put(next, map.get(key)); } } } } int total = - 1; for (Map.Entry entry : map.entrySet()) { if (entry.getKey() >= 0) { total += entry.getValue(); total %= MOD; } } System.out.println(total); } }