#include <bits/stdc++.h>
using namespace std;
long long n, T, ans, dp[34000][4];
pair<int, int> song[20];
int main() {
  int i, j, poz, config, timp, genre;
  cin >> n >> T;
  for (i = 0; i < n; ++i) {
    cin >> timp >> genre;
    song[i] = make_pair(timp, genre - 1);
  }
  for (i = 1; i < (1 << n); ++i) {
    config = i;
    poz = 0;
    timp = 0;
    while (config) {
      if (config % 2) {
        timp += song[poz].first;
        genre = song[poz].second;
        if (i == (1 << poz)) {
          dp[i][genre] = (dp[i][genre] + 1) % (int)(1e9 + 7);
          break;
        }
        for (j = 0; j < 3; ++j) {
          if (j != genre) {
            dp[i][genre] =
                (dp[i][genre] + dp[i - (1 << poz)][j]) % (int)(1e9 + 7);
          }
        }
      }
      ++poz;
      config /= 2;
    }
    if (timp == T) {
      for (j = 0; j < 3; ++j) {
        ans = (ans + dp[i][j]) % (int)(1e9 + 7);
      }
    }
  }
  cout << ans;
  return 0;
}
