#include <bits/stdc++.h>
using namespace std;
inline char nc() {
  static char buf[100000], *p1, *p2;
  return p1 == p2 && (p2 = (p1 = buf) + fread(buf, 1, 100000, stdin), p1 == p2)
             ? EOF
             : *p1++;
}
long long rd() {
  long long x = 0;
  char ch = nc();
  while (ch < '0' || ch > '9') ch = nc();
  while (ch >= '0' && ch <= '9') x = (x << 3) + (x << 1) + ch - '0', ch = nc();
  return x;
}
const long long MAX_N = 15, MAX_M = 250, MOD = 1e9 + 7;
long long n, T, cnt = -1, ans = 0, A, B;
int dp[(1 << MAX_N)][MAX_N];
int g[MAX_N];
int t[MAX_N];
int _sum(int a, int b) {
  int c = a + b;
  if (MOD <= c) c -= MOD;
  return c;
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0);
  cin >> n >> T;
  for (int i = 0; i < n; i++) {
    cin >> t[i] >> g[i];
    dp[(1 << i)][i] = 1;
  }
  for (int mask = 0; mask < (1 << n); mask++) {
    if (1 < __builtin_popcount(mask))
      for (int j = 0; j < n; j++)
        if ((mask >> j) & 1)
          for (int k = 0; k < n; k++)
            if (((mask >> k) & 1) && j != k && g[j] != g[k])
              dp[mask][j] = _sum(dp[mask][j], dp[mask ^ (1 << j)][k]);
  }
  for (int mask = 1; mask < (1 << n); mask++)
    for (int j = 0; j < n; j++)
      if ((mask >> j) & 1) {
        int ti = 0;
        for (int k = 0; k < n; k++)
          if ((mask >> k) & 1) ti += t[k];
        if (ti == T) ans = _sum(ans, dp[mask][j]);
      }
  cout << ans << "\n";
  return 0;
}
