#include <bits/stdc++.h>
using namespace std;
inline long long qpow(long long a, long long b, long long mod) {
  long long res = 1;
  while (b) {
    if (b & 1) res = (res * a) % mod;
    a = (a * a) % mod;
    b >>= 1;
  }
  return res;
}
const int mod = 1e9 + 7;
const int MAXN = 2e5 + 7;
int t[16], g[16];
int dp[1 << 23][3];
int main() {
  int n, m;
  cin >> n >> m;
  for (int i = 1; i <= n; ++i) {
    cin >> t[i] >> g[i];
  }
  dp[0][1] = dp[0][2] = dp[0][3] = 1;
  for (int i = 0; i < (1 << n); ++i) {
    for (int j = 0; j < n; ++j) {
      if ((i >> j) & 1) continue;
      for (int k = 1; k <= 3; ++k) {
        if (k == g[j + 1]) continue;
        dp[i | 1 << j][g[j + 1]] += dp[i][k];
        dp[i | 1 << j][g[j + 1]] %= mod;
      }
    }
  }
  long long res = 0;
  for (int i = 0; i < (1 << n); ++i) {
    for (int j = 1; j <= 3; ++j) {
      int tmp = 0;
      for (int k = 0; k < n; ++k) {
        if ((i >> k) & 1) {
          tmp += t[k + 1];
        }
      }
      if (tmp == m) {
        res += dp[i][j];
        res %= mod;
      }
    }
  }
  cout << res * qpow(2, mod - 2, mod) % mod << endl;
  return 0;
}
