#include <bits/stdc++.h>
using namespace std;
const int64_t M1 = 998244353;
const int64_t M2 = 1000000007;
int64_t dp[1 << 15][3][226];
int64_t t[15], g[15];
void solve() {
  int64_t n, total;
  cin >> n >> total;
  for (int64_t i = 0; i < n; i++) {
    cin >> t[i] >> g[i];
    dp[1 << i][--g[i]][t[i]] = 1;
  }
  for (int64_t mask = 0; mask < (1 << n); mask++) {
    for (int64_t i = 0; i < n; i++) {
      if (!((mask >> i) & 1)) {
        for (int64_t j = 0; j < 3; j++) {
          if (j == g[i]) continue;
          for (int64_t ti = 0; ti <= total - t[i]; ti++) {
            dp[mask | (1 << i)][g[i]][ti + t[i]] =
                (dp[mask | (1 << i)][g[i]][ti + t[i]] +
                 (dp[mask][j][ti] * dp[1 << i][g[i]][t[i]]) % M2) %
                M2;
          }
        }
      }
    }
  }
  int64_t ans = 0;
  for (int64_t mask = 0; mask < (1 << n); mask++) {
    for (int64_t i = 0; i < 3; i++) ans = (ans + dp[mask][i][total]) % M2;
  }
  cout << ans << "\n";
}
int32_t main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  solve();
}
