#include <bits/stdc++.h>
using namespace std;
const double eps = 1e-6;
const int maxn = 1e5 + 5;
const int mod = 1e9 + 7;
inline int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
long long dp[1 << 15][230][4];
int n, T, val[20], g[20];
long long solve(int s, int tmp, int k) {
  if (tmp == 0) return 1;
  if (tmp < 0) return 0;
  if (dp[s][tmp][k] != -1) return dp[s][tmp][k];
  long long ans = 0;
  for (int i = 0; i < n; i++) {
    if (!(s & (1 << i))) {
      if (g[i] != k) {
        ans = (ans + solve(s ^ (1 << i), tmp - val[i], g[i])) % mod;
      }
    }
  }
  return dp[s][tmp][k] = ans;
}
int main() {
  scanf("%d%d", &n, &T);
  for (int i = 0; i < n; i++) scanf("%d%d", &val[i], &g[i]);
  memset(dp, -1, sizeof(dp));
  ;
  int st = 1 << n;
  printf("%lld\n", solve(0, T, 0));
}
