#include <bits/stdc++.h>
using namespace std;
const int N = 15;
const int T = 226;
const int G = 4;
const int mod = 1e9 + 7;
int mem[G][T][1 << N];
int done[G][T][1 << N];
int t[N], g[N];
int n, len;
int dp(int prevGenre, int maxTime, int mask) {
  if (maxTime < 0) return 0;
  if (maxTime == 0) {
    return 1;
  }
  int &ans = mem[prevGenre][maxTime][mask];
  if (!done[prevGenre][maxTime][mask]) {
    ans = 0;
    done[prevGenre][maxTime][mask] = 1;
    for (__typeof(n) j = (0) - ((0) > (n)); j != n - ((0) > (n));
         j += 1 - 2 * ((0) > (n))) {
      if (!((mask >> j) & 1) && prevGenre != g[j]) {
        ans += dp(g[j], maxTime - t[j], mask | (1 << j));
        ans %= mod;
      }
    }
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> len;
  for (__typeof(n) i = (0) - ((0) > (n)); i != n - ((0) > (n));
       i += 1 - 2 * ((0) > (n)))
    cin >> t[i] >> g[i];
  g[n] = 5;
  int sum = dp(0, len, 0);
  cout << sum << '\n';
  return 0;
}
