#include <bits/stdc++.h>
using namespace std;
const int maxn = 1 << 16, P = 1e9 + 7;
int n, T;
int dp[maxn][17], t[maxn], g[maxn];
int main() {
  scanf("%d%d", &n, &T);
  for (int i = 0; i < n; ++i) scanf("%d%d", &t[i], &g[i]);
  for (int i = 0; i < n; ++i) dp[1 << i][i] = 1;
  for (int S = 1; S < 1 << n; ++S) {
    for (int i = 0; i < n; ++i)
      if (!(S >> i & 1)) {
        for (int j = 0; j < n; ++j)
          if ((S >> j & 1) && g[i] != g[j])
            dp[S ^ (1 << i)][i] = (dp[S ^ (1 << i)][i] + dp[S][j]) % P;
      }
  }
  int ans = 0;
  for (int S = 0; S < 1 << n; ++S) {
    int sum = 0;
    for (int i = 0; i < n; ++i)
      if (S >> i & 1) sum += t[i];
    if (sum == T)
      for (int i = 0; i < n; ++i) ans = (ans + dp[S][i]) % P;
  }
  printf("%d\n", ans);
  return 0;
}
