#include <bits/stdc++.h>
using namespace std;
const int MaxN = 2e6 + 9;
const int md = 1e9 + 7;
vector<int> Gr[20];
bitset<20> used;
void dfs(int v) {
  used[v] = 1;
  for (int to : Gr[v]) {
    if (used[to]) continue;
    dfs(to);
  }
}
int dp[1 << 15][4];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int N, T;
  cin >> N >> T;
  vector<int> Tm(N);
  vector<int> Gr(N);
  int Sum = 0;
  for (int i = 0; i < N; i++) {
    cin >> Tm[i] >> Gr[i];
    Sum += Tm[i];
    Gr[i]--;
  }
  int Ans = 0;
  dp[0][3] = 1;
  for (int mask = 0; mask < (1 << N); mask++) {
    for (int g = 0; g < 4; g++) {
      for (int i = 0; i < N; i++) {
        if (!(mask & (1 << i)) && Gr[i] != g) {
          dp[mask | (1 << i)][Gr[i]] += dp[mask][g];
          if (dp[mask | (1 << i)][Gr[i]] >= md)
            dp[mask | (1 << i)][Gr[i]] -= md;
        }
      }
      int Sum = 0;
      for (int i = 0; i < N; i++) {
        if (mask & (1 << i)) Sum += Tm[i];
      }
      if (mask == 8 + 1) cerr << 1;
      if (Sum == T) {
        Ans += dp[mask][g];
        if (Ans >= md) Ans -= md;
      }
    }
  }
  cout << Ans;
  return 0;
}
