#include <bits/stdc++.h>
using namespace std;
long long mod = 1e9 + 7;
const long long MAX = 1e18;
const long long MIN = -1e18;
long long fexpo(long long a, long long b, long long mod) {
  long long ans = 1;
  while (b) {
    if (b % 2) ans = (ans * a) % mod;
    b /= 2;
    a = (a * a) % mod;
  }
  return ans;
}
long long dp[15][15][15][4];
long long ways(int n1, int n2, int n3, int last) {
  int cnt = 0, mx = 0;
  if (n1 == 0) cnt++;
  if (n2 == 0) cnt++;
  if (n3 == 0) cnt++;
  mx = max(n1, max(n2, n3));
  if (cnt == 3) return 0;
  if (cnt == 2) {
    if (mx > 1) return 0;
    return 1;
  }
  if (dp[n1][n2][n3][last] != -1) return dp[n1][n2][n3][last];
  dp[n1][n2][n3][last] = 0;
  if (last != 1 && n1 != 0)
    dp[n1][n2][n3][last] += (n1 * ways(n1 - 1, n2, n3, 1)) % mod;
  if (last != 2 && n2 != 0)
    dp[n1][n2][n3][last] += (n2 * ways(n1, n2 - 1, n3, 2)) % mod;
  if (last != 3 && n3 != 0)
    dp[n1][n2][n3][last] += (n3 * ways(n1, n2, n3 - 1, 3)) % mod;
  return dp[n1][n2][n3][last] % mod;
}
int main() {
  int n, T;
  cin >> n >> T;
  vector<pair<int, int> > song;
  for (int i = 0; i < n; i++) {
    int t, g;
    cin >> t >> g;
    song.push_back({t, g});
  }
  long long ans = 0;
  for (int i = 0; i < (1 << n); i++) {
    int sum = 0;
    int cnt[4] = {0, 0, 0, 0};
    for (int j = 0; j < n; j++) {
      if ((1 << j) & i) {
        sum += song[j].first;
        cnt[song[j].second]++;
      }
    }
    if (sum == T) {
      for (int j = 0; j <= cnt[1]; j++)
        for (int k = 0; k <= cnt[2]; k++)
          for (int l = 0; l <= cnt[3]; l++)
            for (int w = 0; w < 4; w++) dp[j][k][l][w] = -1;
      ans = (ans + ways(cnt[1], cnt[2], cnt[3], 0)) % mod;
      ans = ans % mod;
    }
  }
  cout << ans;
}
