#include <bits/stdc++.h>
using namespace std;
const long long N = 16, TT = 255, GM = 14341434;
long long t[N], g[N];
long long dp[N][N][N][3];
long long n, T;
long long solve(long long g1, long long g2, long long g3, long long lg = -1) {
  if (g1 == 0 && g2 == 0 && g3 == 0) {
    return 1;
  }
  if (lg == -1) {
    long long ans = 0;
    if (g1) {
      ans += g1 * solve(g1 - 1, g2, g3, 1) % 1000000007;
    }
    ans %= 1000000007;
    if (g2) {
      ans += g2 * solve(g1, g2 - 1, g3, 2) % 1000000007;
    }
    ans %= 1000000007;
    if (g3) {
      ans += g3 * solve(g1, g2, g3 - 1, 3) % 1000000007;
    }
    ans %= 1000000007;
    return ans;
  }
  if (dp[g1][g2][g3][lg] != -1) return dp[g1][g2][g3][lg];
  long long& ans = dp[g1][g2][g3][lg];
  ans = 0;
  if (lg != 1 && g1) {
    ans += g1 * solve(g1 - 1, g2, g3, 1) % 1000000007;
  }
  ans %= 1000000007;
  if (lg != 2 && g2) {
    ans += g2 * solve(g1, g2 - 1, g3, 2) % 1000000007;
  }
  ans %= 1000000007;
  if (lg != 3 && g3) {
    ans += g3 * solve(g1, g2, g3 - 1, 3) % 1000000007;
  }
  ans %= 1000000007;
  return ans;
}
signed main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  for (long long g1 = (0); g1 <= (N - 1); g1++) {
    for (long long g2 = (0); g2 <= (N - 1); g2++) {
      for (long long g3 = (0); g3 <= (N - 1); g3++) {
        fill(dp[g1][g2][g3], dp[g1][g2][g3] + 3, -1);
      }
    }
  }
  cin >> n >> T;
  for (long long i = (1); i <= (n); i++) {
    cin >> t[i] >> g[i];
  }
  long long ans = 0;
  for (long long mask = (0); mask <= ((1 << n) - 1); mask++) {
    long long ti = 0, g1 = 0, g2 = 0, g3 = 0;
    for (long long i = (1); i <= (n); i++) {
      if (mask & (1 << (i - 1))) {
        ti += t[i];
        g1 += g[i] == 1;
        g2 += g[i] == 2;
        g3 += g[i] == 3;
      }
    }
    if (ti == T) {
      ans = (ans + solve(g1, g2, g3)) % 1000000007;
    }
  }
  cout << ans << "\n";
  return 0;
}
