#include <bits/stdc++.h>
using namespace std;
constexpr int MAXN = 20, MOD = 1e9 + 7;
int way[1 << MAXN][MAXN];
int D[MAXN], G[MAXN];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  int N, T;
  cin >> N >> T;
  for (int i = 0; i < N; i++) {
    cin >> D[i] >> G[i];
  }
  for (int i = 1; i < (1 << N); i++) {
    for (int j = 0; j < N; j++) {
      if (~i & 1 << j) {
        continue;
      }
      if (__builtin_popcount(i) == 1) {
        way[i][j] = 1;
      }
      for (int k = 0; k < N; k++) {
        if (i & 1 << k) {
          continue;
        }
        if (G[j] == G[k]) {
          continue;
        }
        way[i | 1 << k][k] += way[i][j];
        way[i | 1 << k][k] %= MOD;
      }
    }
  }
  int sum = 0;
  for (int i = 0; i < (1 << N); i++) {
    int tim = 0;
    for (int j = 0; j < N; j++) {
      if (i & 1 << j) {
        tim += D[j];
      }
    }
    if (tim != T) {
      continue;
    }
    for (int j = 0; j < N; j++) {
      sum += way[i][j];
      sum %= MOD;
    }
  }
  cout << sum << endl;
  return 0;
}
