#include <bits/stdc++.h>
const int mod = 1e9 + 7;
using namespace std;
int n, t;
int x1[20], x2[20];
int dp[230][1 << 15][4];
int solve(int T, int mask, int last) {
  if (T == 0) return 1;
  if (mask == 0) return 0;
  if (dp[T][mask][last] != -1) return dp[T][mask][last];
  dp[T][mask][last] = 0;
  for (int i = 0; i < n; i++) {
    if ((mask & (1 << i)) && last != x2[i] && T - x1[i] >= 0) {
      dp[T][mask][last] += solve(T - x1[i], mask ^ (1 << i), x2[i]);
      dp[T][mask][last] %= mod;
    }
  }
  return dp[T][mask][last] % mod;
}
int main() {
  cin >> n >> t;
  for (int i = 0; i < n; i++) {
    cin >> x1[i] >> x2[i];
    x2[i]--;
  }
  memset(dp, -1, sizeof dp);
  cout << solve(t, (1 << n) - 1, 3);
  return 0;
}
