#include <bits/stdc++.h>
using namespace std;
inline long long read() {
  long long sum = 0, ff = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') ff = -1;
    ch = getchar();
  }
  while (isdigit(ch)) sum = sum * 10 + (ch ^ 48), ch = getchar();
  return sum * ff;
}
const long long N = 16;
const long long mo = 1e9 + 7;
long long n, m, f[1 << N][5], g[1 << N], a[N], b[N], ans;
inline long long ksm(long long x, long long y) {
  long long ret = 1;
  while (y) {
    if (y & 1) ret = ret * x % mo;
    x = x * x % mo;
    y >>= 1ll;
  }
  return ret;
}
signed main() {
  n = read();
  m = read();
  for (long long i = 1; i <= n; i++) {
    a[i] = read();
    b[i] = read();
  }
  for (long long i = 1; i <= 3; i++) f[0][i] = 1;
  for (long long i = 0; i < (1 << n); i++)
    for (long long j = 1; j <= n; j++) {
      if (i & (1 << j - 1)) continue;
      for (long long k = 1; k <= 3; k++)
        if (b[j] != k)
          f[i | (1 << j - 1)][b[j]] =
              (f[i | (1 << j - 1)][b[j]] + f[i][k]) % mo;
    }
  for (long long i = 0; i < (1 << n); i++) {
    long long tot = 0;
    for (long long j = 1; j <= n; j++)
      if (i & (1 << j - 1)) tot += a[j];
    if (tot == m) ans = (ans + f[i][1] + f[i][2] + f[i][3]) % mo;
  }
  printf("%lld\n", ans * ksm(2ll, mo - 2) % mo);
  return 0;
}
