#include <bits/stdc++.h>
using namespace std;
mt19937 rnd(time(0));
const long long mod = 1e9 + 7;
void solve() {
  long long n, t;
  cin >> n >> t;
  pair<long long, long long> a[n];
  for (long long i = 0; i < n; ++i) {
    cin >> a[i].first >> a[i].second;
  }
  long long dp[(1 << n)][n];
  memset(dp, 0, sizeof(dp));
  for (long long i = 0; i < n; ++i) {
    dp[(1 << i)][i] = 1;
  }
  for (long long m = 1; m < (1 << n); ++m) {
    for (long long i = 0; i < n; ++i) {
      if (m & (1 << i)) {
        for (long long j = 0; j < n; ++j) {
          if ((m & (1 << j)) && a[i].second != a[j].second) {
            dp[m][i] += dp[m ^ (1 << i)][j];
            dp[m][i] %= mod;
          }
        }
      }
    }
  }
  long long ans = 0;
  for (long long m = 1; m < (1 << n); ++m) {
    for (long long i = 0; i < n; ++i) {
      long long sum = 0;
      for (long long j = 0; j < n; ++j) {
        if (m & (1 << j)) sum += a[j].first;
      }
      if (sum == t) {
        ans += dp[m][i];
        ans %= mod;
      }
    }
  }
  cout << ans << endl;
}
signed main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  long long t = 1;
  while (t--) {
    solve();
  }
  return 0;
}
