#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9 + 7;
int g[20], t[20];
int d[600010][20];
int main() {
  int n, T;
  scanf("%d %d", &n, &T);
  for (int i = 1; i <= n; i++) {
    scanf("%d %d", &t[i], &g[i]);
    g[i]--;
  }
  d[0][3] = 1;
  int re = 0;
  for (int i = 0; i < 1 << n; i++) {
    for (int j = 3; j >= 0; j--) {
      for (int k = 1; k <= n; k++) {
        if (d[i][j] == 0) continue;
        if (g[k] != j && ((i & (1 << (k - 1))) == 0)) {
          d[i ^ (1 << (k - 1))][g[k]] =
              (d[i ^ (1 << (k - 1))][g[k]] + d[i][j]) % mod;
        }
      }
      int sum = 0;
      for (int k = 1; k <= n; k++) {
        if (i & (1 << (k - 1))) sum += t[k];
      }
      if (sum == T) re = (re + d[i][j]) % mod;
    }
  }
  printf("%d\n", re);
}
