#include <bits/stdc++.h>
using namespace std;
struct item {
  int t;
  int j;
};
const int MOD = 1e9 + 7;
int get_sum(int mask, int n, vector<item> a) {
  int res = 0;
  for (int i = 0; i < n; i++) {
    int k = (1 << i);
    if ((mask & k) != 0) {
      res += a[i].t;
      res %= MOD;
    }
  }
  return res;
}
int main() {
  int n, t;
  scanf("%d %d", &n, &t);
  vector<item> a(n);
  for (int i = 0; i < n; i++) {
    scanf("%d %d", &a[i].t, &a[i].j);
  }
  vector<vector<int>> dp((1 << n), vector<int>(3 + 1, 0));
  for (int i = 0; i < n; i++) dp[(1 << i)][a[i].j]++;
  for (int mask = 1; mask < (1 << n); mask++) {
    for (int last = 1; last <= 3; last++) {
      for (int newSong = 0; newSong < n; newSong++) {
        if (((1 << newSong) & mask) == 0 && last != a[newSong].j)
          dp[mask | (1 << newSong)][a[newSong].j] += dp[mask][last];
        dp[mask | (1 << newSong)][a[newSong].j] %= MOD;
      }
    }
  }
  int ans = 0;
  for (int mask = 1; mask < (1 << n); mask++) {
    if (get_sum(mask, n, a) == t) {
      for (int lst = 1; lst <= 3; lst++) {
        ans += dp[mask][lst];
        ans %= MOD;
      }
    }
  }
  printf("%d", ans);
  return 0;
}
