#include <bits/stdc++.h>
using namespace std;
string to_string(const string& s) { return '"' + s + '"'; }
string to_string(const bool b) { return (b ? "true" : "false"); }
string to_string(const char* s) { return to_string((string)s); }
string to_string(const char c) {
  string s = "'";
  s += c;
  s += "'";
  return s;
}
template <class T, class U>
string to_string(const pair<T, U>& p) {
  string s = "(";
  s += to_string(p.first);
  s += ", ";
  s += to_string(p.second);
  s += ")";
  return s;
}
template <class T>
string to_string(const T& a) {
  bool first = true;
  string s = "{";
  for (const auto& x : a) {
    if (!first) {
      s += ", ";
    }
    first = false;
    s += to_string(x);
  }
  s += "}";
  return s;
}
void debug_out() { cerr << '\n'; }
template <class Head, class... Tail>
void debug_out(Head head, Tail... tail) {
  cerr << ' ' << to_string(head);
  debug_out(tail...);
}
using ll = long long;
using ld = long double;
const int mod = 1e9 + 7;
const int inf = 1e9 + 100;
const ll inf64 = 7e18l;
const int maxn = 1e5 + 5;
void add_self(int& a, int b) {
  a += b;
  if (a >= mod) {
    a -= mod;
  }
}
void max_self(int& a, int b) { a = max(a, b); }
const int maxT = 226;
const int max_mask = 1 << 16;
int dp[maxT][max_mask][3];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout << fixed << setprecision(20);
  int n, T;
  cin >> n >> T;
  vector<pair<int, int>> a(n);
  for (int i = 0; i < n; ++i) {
    cin >> a[i].first >> a[i].second;
    --a[i].second;
  }
  int m = (1 << n);
  for (int type = 0; type < 3; ++type) {
    dp[0][0][type] = 1;
  }
  for (int t = 1; t <= T; ++t) {
    for (int mask = 0; mask < m; ++mask) {
      for (int i = 0; i < n; ++i) {
        if (mask & (1 << i)) {
          continue;
        }
        if (t - a[i].first >= 0) {
          for (int type = 0; type < 3; ++type) {
            if (type != a[i].second) {
              add_self(dp[t][mask | (1 << i)][a[i].second],
                       dp[t - a[i].first][mask][type]);
            }
          }
        }
      }
    }
  }
  ll answer = 0;
  for (int mask = 0; mask < m; ++mask) {
    for (int type = 0; type < 3; ++type) {
      answer += dp[T][mask][type];
    }
  }
  answer /= 2;
  cout << answer % mod << '\n';
  return 0;
}
