import java.io.*; import java.util.*; public class Main { static final int MOD = 1000000007; public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); int k = sc.nextInt(); int[] values = new int[n]; for (int i = 0; i < n; i++) { values[i] = sc.nextInt() - k; } TreeMap map = new TreeMap<>(); for (int i = 0; i < n; i++) { if (values[i] < 0) { Integer key = Integer.MIN_VALUE; while ((key = map.higherKey(key)) != null) { int next = key + values[i]; map.put(next, (map.getOrDefault(next, 0) + map.get(key)) % MOD); } } else { Integer key = Integer.MAX_VALUE; while ((key = map.lowerKey(key)) != null) { int next = key + values[i]; map.put(next, (map.getOrDefault(next, 0) + map.get(key)) % MOD); } } map.put(values[i], (map.getOrDefault(values[i], 0) + 1) % MOD); } int ans = 0; for (int x : map.keySet()) { if (x < 0) { continue; } ans += map.get(x); ans %= MOD; } System.out.println(ans); } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public String next() throws Exception { if (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }