#include <bits/stdc++.h>
using namespace std;
int dx[] = {0, 0, 1, -1, -1, -1, 1, 1};
int dy[] = {1, -1, 0, 0, -1, 1, 1, -1};
template <class T>
inline T biton(T n, T pos) {
  return n | ((T)1 << pos);
}
template <class T>
inline T bitoff(T n, T pos) {
  return n & ~((T)1 << pos);
}
template <class T>
inline T ison(T n, T pos) {
  return (bool)(n & ((T)1 << pos));
}
template <class T>
inline T gcd(T a, T b) {
  while (b) {
    a %= b;
    swap(a, b);
  }
  return a;
}
template <typename T>
string NumberToString(T Number) {
  ostringstream second;
  second << Number;
  return second.str();
}
inline int nxt() {
  int aaa;
  scanf("%d", &aaa);
  return aaa;
}
inline long long int lxt() {
  long long int aaa;
  scanf("%lld", &aaa);
  return aaa;
}
inline double dxt() {
  double aaa;
  scanf("%lf", &aaa);
  return aaa;
}
template <class T>
inline T bigmod(T p, T e, T m) {
  T ret = 1;
  for (; e > 0; e >>= 1) {
    if (e & 1) ret = (ret * p) % m;
    p = (p * p) % m;
  }
  return (T)ret;
}
vector<pair<pair<int, int>, int> > v;
long long int dp[201][3002];
int go(int pos, int l) {
  if (l == 0) return 1;
  if (l < 0) return 0;
  long long int& res = dp[pos][l];
  if (res != -1) return res;
  res = 0;
  for (int i = 0; i < v.size(); i++) {
    if (v[pos].second == v[i].second) continue;
    if (v[pos].first.second == v[i].first.first) {
      res += go(i, l - v[i].first.first);
      if (res >= 1000000007) res -= 1000000007;
    }
  }
  return res;
}
int main() {
  int n = nxt();
  int l = nxt();
  for (int i = 0; i < n; i++) {
    int a = nxt();
    int b = nxt();
    v.push_back(make_pair(make_pair(a, b), i));
    if (a != b) v.push_back(make_pair(make_pair(b, a), i));
  }
  memset(dp, -1, sizeof(dp));
  long long int res = 0;
  for (int i = 0; i < v.size(); i++)
    res += go(i, l - v[i].first.first), res %= 1000000007;
  cout << res << endl;
  return 0;
}
