#include <bits/stdc++.h>
using namespace std;
const int MOD = 1e9 + 7;
int n, T, t[20], g[20];
int ans[(1 << 15)][230][4];
bool found[(1 << 15)][230][4];
int dp(int mask, int rem, int last) {
  if (rem < 0) return 0;
  if (rem == 0) return 1;
  if (found[mask][rem][last]) return ans[mask][rem][last];
  found[mask][rem][last] = true;
  ans[mask][rem][last] = 0;
  for (int i = 0; i < n; ++i)
    if (((mask & (1 << i)) == 0) && g[i] != last) {
      int tmp = dp(mask + (1 << i), rem - t[i], g[i]);
      ans[mask][rem][last] = (ans[mask][rem][last] + tmp) % MOD;
    }
  return ans[mask][rem][last];
}
int main() {
  scanf("%d %d", &n, &T);
  for (int i = 0; i < n; ++i) {
    scanf("%d %d", &t[i], &g[i]);
  }
  printf("%d\n", dp(0, T, 0));
}
