#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 10;
const long long int LINF = 1LL * INF * INF;
const int MAXN = 2e5 + 10;
const int MAXM = 5e3 + 10;
priority_queue<int> pq;
vector<vector<int> > graph;
queue<int> que;
pair<int, int> A[20];
long long int dp[20][(1 << 20)];
long long int sum[(1 << 20)];
long long int solve(int here, int cur, int n) {
  if (dp[here][cur] != -1) return dp[here][cur];
  long long int res = 0;
  for (int i = 0; i < n; i++) {
    if (i == here) continue;
    if ((1 << i) & cur) {
      if (A[i].second == A[here].second) continue;
      res += solve(i, cur ^ (1 << here), n);
      res %= 1000000007;
    }
  }
  return dp[here][cur] = res;
}
int main() {
  int n, m, k, a, b, x, y;
  int cnt = 0;
  int mx = 0;
  int mn = INF;
  int cur = 0, idx = -1;
  int T;
  cin >> n >> T;
  for (int i = 0; i < n; i++) cin >> A[i].first >> A[i].second;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < (1 << n); j++) dp[i][j] = -1;
  for (int i = 0; i < n; i++) dp[i][(1 << i)] = 1;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < (1 << n); j++) solve(i, j, n);
  for (int i = 0; i < (1 << n); i++)
    for (int j = 0; j < n; j++)
      if ((1 << j) & i) sum[i] += (long long int)A[j].first;
  long long int res = 0;
  for (int i = 0; i < (1 << n); i++) {
    if (sum[i] != T) continue;
    for (int j = 0; j < n; j++)
      if ((1 << j) & i) {
        res += (long long int)dp[j][i];
        res %= 1000000007;
      }
  }
  cout << res;
  return 0;
}
