#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int n, T;
int t[20], g[20];
int dp[1 << 15][4][226];
int f(int mask, int last, int curr) {
  if (curr > T) return 0;
  if (curr == T) return 1;
  int &ans = dp[mask][last][curr];
  if (ans != -1) return ans;
  ans = 0;
  for (int i = 0; i < n; i++) {
    if (mask & (1 << i)) continue;
    if (g[i] == last) continue;
    ans += f(mask | (1 << i), g[i], curr + t[i]);
    if (ans >= mod) ans -= mod;
  }
  return ans;
}
void solve() {
  cin >> n >> T;
  for (int i = 0; i < n; i++) cin >> t[i] >> g[i];
  memset(dp, -1, sizeof dp);
  cout << f(0, 0, 0);
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  int testcase = 1;
  for (int i = 1; i <= testcase; i++) {
    solve();
  }
  return 0;
}
