#include <bits/stdc++.h>
using namespace std;
bool Check(int n, int pos) { return (bool)(n & (1 << pos)); }
int Set(int n, int pos) { return n = (n | (1 << pos)); }
int n, t, mod = 1e9 + 7, dur[105], genre[105], dp[(1 << 16) + 2][226][3],
          cur_len;
int func(int mask, int sum, int pre) {
  if (mask == (1 << n) - 1) {
    return (sum == t);
  }
  if (sum == t) return 1;
  if (dp[mask][sum][pre] != -1) {
    return dp[mask][sum][pre];
  }
  int ans = 0;
  for (int i = 0; i < n; i++) {
    if (!Check(mask, i)) {
      if (genre[i] != pre && sum + dur[i] <= t) {
        int temp = func(Set(mask, i), sum + dur[i], genre[i]);
        ans = ((ans % mod) + (temp % mod)) % mod;
      }
    }
  }
  return dp[mask][sum][pre] = ans;
}
int main() {
  int i, j;
  scanf("%d %d", &n, &t);
  for (i = 0; i < n; i++) {
    scanf("%d %d", &dur[i], &genre[i]);
    genre[i]--;
  }
  int ans = 0;
  memset(dp, -1, sizeof dp);
  for (i = 0; i < n; i++) {
    int m = 0;
    m = Set(m, i);
    int temp = func(m, dur[i], genre[i]);
    ans = ((ans % mod) + (temp % mod)) % mod;
  }
  printf("%d\n", ans);
  return 0;
}
