#include <bits/stdc++.h>
using namespace std;
const long long N = 16, MOD = 1e9 + 7;
vector<pair<long long, long long> > a(N);
long long dp[(1 << N)][4];
long long n, T;
long long DPRecur(long long mask, long long LastGenre) {
  if (dp[mask][LastGenre] != -1) return dp[mask][LastGenre];
  dp[mask][LastGenre] = 0;
  long long sum = 0;
  for (long long i = 0; i < n; i++) {
    if ((1 << i) & mask) sum += a[i].first;
  }
  if (sum == T) return dp[mask][LastGenre] = 1;
  for (long long i = 0; i < n; i++) {
    if (!((1 << i) & mask)) {
      if (LastGenre != a[i].second)
        dp[mask][LastGenre] += DPRecur(mask | (1 << i), a[i].second);
      dp[mask][LastGenre] %= MOD;
    }
  }
  return dp[mask][LastGenre];
}
void Solve() {
  cin >> n >> T;
  long long sum = 0;
  for (long long i = 0; i < n; i++) {
    cin >> a[i].first >> a[i].second;
    sum += a[i].first;
  }
  if (sum < T) {
    cout << "0" << endl;
    return;
  }
  for (long long i = 0; i < (1 << N); i++) {
    for (long long j = 0; j < 4; j++) {
      dp[i][j] = -1;
    }
  }
  long long cnt = 0, ans = 0;
  for (long long i = 1; i < (1 << n); i *= 2) {
    ans += DPRecur(i, a[cnt++].second);
    ans %= MOD;
  }
  cout << ans << endl;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  Solve();
  return 0;
}
