#include <bits/stdc++.h>
using namespace std;
long long t = 1, n;
long long dp[1 << 15][4];
vector<long long> tim(18), genre(19);
inline int add(int x, int y) {
  x += y;
  return x % (long long)1000000007;
}
inline int mult(int x, int y) { return (x * 1LL * y) % (long long)1000000007; }
inline int powMod(long long base, long long expo) {
  int ans = 1;
  while (expo) {
    if (expo & 1) {
      ans = mult(ans, base);
    }
    base = mult(base, base);
    expo >>= 1;
  }
  return ans;
}
void solve() {
  long long T, ans = 0;
  cin >> n >> T;
  for (long long i = 0; i < n; i += 1) {
    cin >> tim[i] >> genre[i];
  }
  memset(dp, 0, sizeof(dp));
  dp[0][0] = 1;
  for (long long mask = 0; mask < 1 << n; mask += 1) {
    for (long long i = 0; i < n; i += 1) {
      for (long long j = 0; j < 4; j += 1) {
        if (((mask >> i) & 1) == 0 and genre[i] != j) {
          dp[mask | (1 << i)][genre[i]] += dp[mask][j];
          dp[mask | (1 << i)][genre[i]] %= (long long)1000000007;
        }
      }
    }
  }
  for (long long mask = 0; mask < 1 << n; mask += 1) {
    long long tot = 0;
    for (long long i = 0; i < n; i += 1) {
      if ((mask >> i) & 1) {
        tot += tim[i];
      }
    }
    if (tot == T) {
      for (long long i = 1; i < 4; i += 1) {
        ans = add(ans, dp[mask][i]);
      }
    }
  }
  cout << ans << "\n";
}
signed main() {
  while (t--) solve();
  return 0;
}
