#include <bits/stdc++.h>
using namespace std;
const int MAXN = 102;
const int MAXL = 3002;
const int MOD = 1000000007;
struct Board {
  int a, b, type;
  bool operator<(const Board& v) const { return a < v.a; }
};
Board board[MAXN * 2];
int dp[MAXL][MAXN * 2];
int main() {
  int n, l;
  scanf("%d %d", &n, &l);
  for (int i = 1; i <= n; i++) {
    scanf("%d %d", &board[i].a, &board[i].b);
    board[i].type = i;
  }
  int sz = n;
  for (int i = 1; i <= n; i++) {
    if (board[i].a == board[i].b) continue;
    sz++;
    board[sz].a = board[i].b, board[sz].b = board[i].a;
    board[sz].type = board[i].type;
  }
  n = sz;
  sort(board + 1, board + 1 + n);
  for (int i = 0; i < l; i++) {
    if (i == 0) {
      for (int k = 1; k <= n; k++)
        if (board[k].a <= l) dp[board[k].a][k]++;
    } else
      for (int j = 1; j <= n; j++) {
        if (dp[i][j] == 0) continue;
        for (int k = 1; k <= n; k++) {
          if (board[k].a < board[j].b || board[k].type == board[j].type)
            continue;
          if (board[k].a + i > l || board[k].a > board[j].b) break;
          dp[i + board[k].a][k] += dp[i][j];
          if (dp[i + board[k].a][k] >= MOD) dp[i + board[k].a][k] -= MOD;
        }
      }
  }
  int ans = 0;
  for (int i = 1; i <= n; i++) {
    ans += dp[l][i];
    if (ans >= MOD) ans -= MOD;
  }
  printf("%d\n", ans);
  return 0;
}
