#include <bits/stdc++.h>
using namespace std;
const long double pi = 2 * acos(0.0);
template <class T>
bool umin(T& a, T b) {
  if (a > b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T>
bool umax(T& a, T b) {
  if (a < b) {
    a = b;
    return 1;
  }
  return 0;
}
template <class T, class TT>
bool pal(T a, TT n) {
  int k = 0;
  for (int i = 0; i <= n / 2; i++) {
    if (a[i] != a[n - i - 1]) {
      k = 1;
      break;
    }
  }
  return k ? 0 : 1;
}
long long ti[333], ge[333], dp[222222][33];
int main() {
  int n, t;
  cin >> n >> t;
  for (int i = 0; i < n; i++) {
    cin >> ti[i] >> ge[i];
    ge[i]--;
  }
  dp[0][3] = 1;
  long long ans = 0;
  for (int i = 0; i < (1 << n); i++) {
    for (int k = 0; k <= 3; k++) {
      for (int j = 0; j < n; j++) {
        if (((i & (1 << j)) == 0) && k != ge[j])
          dp[i ^ (1 << j)][ge[j]] =
              (dp[i ^ (1 << j)][ge[j]] + dp[i][k]) % 1000000007;
      }
      long long sum = 0;
      for (int j = 0; j < n; j++)
        if (i & (1 << j)) sum += ti[j];
      if (sum == t) ans = (ans + dp[i][k]) % 1000000007;
    }
  }
  cout << ans;
  getchar();
  getchar();
  return 0;
}
