#include <bits/stdc++.h>
using namespace std;
template <typename T>
string tostr(const T& t) {
  ostringstream os;
  os << t;
  return os.str();
}
int N, L;
long long MOD = 1000000007;
typedef struct {
  int length;
  int width;
} typeboard;
vector<typeboard> boards;
int memo[110][110][3010];
int go(int prevType, int prevWidth, int totLen) {
  if (totLen == L) return 1LL;
  if (totLen > L) return 0LL;
  int& ref = memo[prevType][prevWidth][totLen];
  if (ref != -1) return ref;
  ref = 0;
  if (prevWidth == 0) {
    for (int i = (int)(0); i <= (int)(N - 1); ++i) {
      ref = (ref + go(i, boards[i].width, boards[i].length)) % MOD;
      if (boards[i].length != boards[i].width)
        ref = (ref + go(i, boards[i].length, boards[i].width)) % MOD;
    }
  } else {
    for (int i = (int)(0); i <= (int)(N - 1); ++i) {
      if (i == prevType) continue;
      if (boards[i].length == prevWidth) {
        ref = (ref + go(i, boards[i].width, totLen + boards[i].length)) % MOD;
      } else if (boards[i].width == prevWidth) {
        ref = (ref + go(i, boards[i].length, totLen + boards[i].width)) % MOD;
      }
    }
  }
  return ref;
}
int main() {
  cin >> N >> L;
  for (int i = (int)(0); i <= (int)(N - 1); ++i) {
    typeboard board;
    cin >> board.length >> board.width;
    boards.push_back(board);
  }
  memset(memo, -1, sizeof memo);
  long long ans = go(0, 0, 0) % MOD;
  cout << ans << endl;
  return 0;
}
