#include <bits/stdc++.h>
using namespace std;
long long n, m, ans, t[1000005], a[1000005], dp[40000][5];
long long f(long long bit, long long son) {
  if (bit == 0) return 1;
  long long &r = dp[bit][son];
  if (r != -1) return r;
  r = 0;
  for (long long i = 0; i < n; i++)
    if ((1 << i) & bit and a[i] != son)
      r = (r + f(bit - (1 << i), a[i])) % 1000000007;
  return r;
}
int main() {
  memset(dp, -1, sizeof dp);
  scanf("%lld %lld", &n, &m);
  for (long long i = 0; i < n; i++) {
    scanf("%lld %lld", t + i, a + i);
  }
  for (long long i = 0; i < (1 << n); i++) {
    long long top = 0;
    for (long long j = 0; j < n; j++)
      if ((1 << j) & i) top += t[j];
    if (top == m) {
      ans = (ans + f(i, 4)) % 1000000007;
    }
  }
  printf("%lld\n", ans);
  return 0;
}
