#include <bits/stdc++.h>
using namespace std;
long long inv(int a, int p) {
  return a == 1 ? 1 : (1 - p * inv(p % a, a)) / a + p;
}
static const int MODVAL = 1000000007;
struct mint {
  int val;
  mint() : val(0) {}
  mint(int x) : val(x % MODVAL) {}
  mint(size_t x) : val(x % MODVAL) {}
  mint(long long x) : val(x % MODVAL) {}
  mint& operator+=(mint y) {
    val = (val + y.val) % MODVAL;
    return *this;
  }
  mint& operator-=(mint y) {
    val = (val - y.val + MODVAL) % MODVAL;
    return *this;
  }
  mint& operator*=(mint y) {
    val = ((long long)val * y.val) % MODVAL;
    return *this;
  }
  mint& operator/=(mint y) {
    val = (val * inv(y.val, MODVAL)) % MODVAL;
    return *this;
  }
};
inline mint operator+(mint x, mint y) { return x += y; }
inline mint operator-(mint x, mint y) { return x -= y; }
inline mint operator*(mint x, mint y) { return x *= y; }
inline mint operator/(mint x, mint y) { return x /= y; }
mint POW(mint x, long long n) {
  mint r(1);
  for (; n; x *= x, n >>= 1)
    if (n & 1) r *= x;
  return r;
}
mint FAC(int n) {
  static vector<mint> FAC_(1, 1);
  while (int(FAC_.size()) <= n) FAC_.push_back(FAC_.back() * FAC_.size());
  return FAC_[n];
}
inline mint CMB(int n, int k) {
  return k < 0 || n < k ? 0 : FAC(n) / (FAC(k) * FAC(n - k));
}
inline ostream& operator<<(ostream& os, mint a) { return os << a.val; }
int n;
int vs[101][2];
mint memo[101][2][3010];
bool visited[101][2][3010];
mint solve(int last, int dir, int rest) {
  mint& res = memo[last][dir][rest];
  if (visited[last][dir][rest]) return res;
  visited[last][dir][rest] = true;
  if (rest == 0) {
    res = 1;
  } else {
    res = 0;
    for (int i = 0; i < (int)(n); ++i) {
      for (int d = 0; d < (int)(2); ++d) {
        if (i == last) continue;
        if (last != 100 && vs[last][1 ^ dir] != vs[i][d]) continue;
        if (vs[i][d] > rest) continue;
        if (d == 1 && vs[i][0] == vs[i][1]) continue;
        res += solve(i, d, rest - vs[i][d]);
      }
    }
  }
  return res;
}
int main(void) {
  int len;
  scanf("%d%d", &n, &len);
  for (int i = 0; i < (int)(n); ++i) {
    scanf("%d%d", &vs[i][0], &vs[i][1]);
  }
  cout << solve(100, 0, len) << endl;
  return 0;
}
