#include <bits/stdc++.h>
using namespace std;
using namespace std;
const int maxs = 1 << 15;
int p = 1e9 + 7;
int dp[maxs + 5][4];
int t[20], g[20];
int main() {
  int n, T;
  cin >> n >> T;
  for (int i = 0; i < n; ++i) cin >> t[i] >> g[i], g[i]--;
  int ans = 0;
  dp[0][3] = 1;
  for (int s = 0; s <= maxs - 1; ++s)
    for (int i = 0; i <= 3; ++i) {
      for (int j = 0; j < n; ++j) {
        if (((s & (1 << j)) == 0) && (g[j] != i)) {
          dp[s ^ (1 << j)][g[j]] = (dp[s ^ (1 << j)][g[j]] + dp[s][i]) % p;
        }
      }
      int x = 0;
      for (int j = 0; j < n; ++j)
        if (s & (1 << j)) x += t[j];
      if (x == T) ans = (ans + dp[s][i]) % p;
    }
  cout << ans << endl;
}
