#include <bits/stdc++.h>
using namespace std;
long long n, t;
std::vector<pair<long long, long long> > v;
long long dp[(1 << 15) + 5][226][4];
long long solve(long long x, long long y, long long z) {
  if (x == 0) return 1;
  if (x < 0) return 0;
  if (dp[y][x][z] != -1) return dp[y][x][z];
  long long ans = 0;
  for (long long i = 0; i < n; i++) {
    if (v[i].second != z and (y & (1 << i))) {
      ans = (ans +
             (solve(x - v[i].first, y - (1 << i), v[i].second)) % 1000000007) %
            1000000007;
    }
  }
  dp[y][x][z] = ans;
  return dp[y][x][z] % 1000000007;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
  cin >> n >> t;
  long long t1, t2;
  for (long long i = 0; i < (1 << 15) + 5; i++)
    for (long long j = 0; j < 226; j++)
      for (long long k = 0; k < 4; k++) dp[i][j][k] = -1;
  for (long long i = 0; i < n; i++) {
    cin >> t1 >> t2;
    v.push_back(make_pair(t1, t2));
  }
  cout << solve(t, (1 << n) - 1, 0);
  return 0;
}
