#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
int n, T, t[16], g[16], dp[32769][4], ans;
int gcd(int a, int b) {
  if (a == 0)
    return b;
  else
    return gcd(b % a, a);
}
int32_t main() {
  ios_base ::sync_with_stdio(0);
  cin.tie();
  cout.tie();
  cin >> n >> T;
  for (int i = 1; i <= n; i++) {
    cin >> t[i] >> g[i];
    g[i]--;
  }
  dp[0][3] = 1;
  for (int msk = 0; msk < (1 << n); msk++) {
    for (int lst = 0; lst <= 3; lst++) {
      for (int i = 1; i <= n; i++) {
        if (g[i] != lst && (msk & (1 << (i - 1))) == 0) {
          dp[msk | (1 << (i - 1))][g[i]] += dp[msk][lst];
          dp[msk | (1 << (i - 1))][g[i]] %= mod;
        }
      }
      int s = 0;
      for (int i = 1; i <= n; i++) {
        if (msk & (1 << (i - 1))) s += t[i];
      }
      if (s == T) ans = (ans + dp[msk][lst]) % mod;
    }
  }
  cout << ans;
}
