#include <bits/stdc++.h>
using namespace std;
struct greateri {
  template <class T>
  bool operator()(T const &a, T const &b) const {
    return a > b;
  }
};
long long n, T;
long long lenghs[15];
long long dp[1 << 15][226][4];
long long genres[15];
long long solve(long long bitmask, long long lengh, long long genre) {
  long long ans = 0;
  if (lengh == T) {
    return 1;
  }
  if (lengh > T) return 0;
  if (dp[bitmask][lengh][genre] != -1)
    return (dp[bitmask][lengh][genre] % 1000000007);
  for (long long i = 0; i < n; ++i) {
    if (!(bitmask & (1 << i)) && lenghs[i] + lengh <= T && genre != genres[i])
      ans = (ans + (solve(bitmask | (1 << i), lengh + lenghs[i], genres[i])) %
                       (1000000007));
  }
  return dp[bitmask][lengh][genre] = (ans % 1000000007);
}
int main() {
  cin >> n >> T;
  memset(dp, -1, sizeof dp);
  for (long long i = 0; i < n; ++i) {
    cin >> lenghs[i];
    cin >> genres[i];
    genres[i]--;
  }
  cout << (solve(0, 0, 3) % (long long)(1e9 + 7));
  return 0;
}
