#include <bits/stdc++.h>
using namespace std;
const long long MOD = 1e9 + 7;
long long dp[226][4][32768];
long long arr[15][4];
long long n, t;
long long exp(long long a, long long b) {
  long long res = 1;
  while (b) {
    if (b & 1) res = (res * a) % MOD;
    a = (a * a) % MOD;
    b >>= 1;
  }
  return res;
}
long long inv(long long a) { return exp(a, MOD - 2); }
long long solve(long long time, long long genre, long long num) {
  if (time < 0) return 0;
  if (time == 0) return dp[time][genre][num] = 1;
  if (dp[time][genre][num] != -1) return dp[time][genre][num];
  long long ans = 0;
  for (long long i = 0; i < 15; i++) {
    if ((num >> i) & 1) {
      if (arr[i][1] != genre) {
        ans = ans + solve(time - arr[i][0], arr[i][1], num ^ (1 << i));
        ans %= MOD;
      }
    }
  }
  return dp[time][genre][num] = ans;
}
signed main() {
  ios_base::sync_with_stdio(NULL);
  cin.tie(0);
  cout.tie(0);
  ;
  cin >> n >> t;
  for (long long i = 0; i < n; i++) {
    cin >> arr[i][0] >> arr[i][1];
  }
  memset(dp, -1, sizeof(dp));
  long long res = 0;
  res += solve(t, 1, (1 << n) - 1);
  res %= MOD;
  res += solve(t, 2, (1 << n) - 1);
  res %= MOD;
  res += solve(t, 3, (1 << n) - 1);
  res %= MOD;
  cout << (res * inv(2)) % MOD << "\n";
  return 0;
}
