#include <bits/stdc++.h>
using namespace std;
const long long int infinity = 9e18;
long long int dp[3001][101][101] = {};
void print2d(long long int l, long long int n) {
  for (int i = 1; i <= l; i++) {
    for (int j = 0; j < n; j++) {
      for (int k = 0; k < 10; k++) {
        cout << dp[i][j][k] << " ";
      }
      cout << "\n";
    }
    cout << "\n"
         << "\n";
  }
  cout << "\n";
  cout << "\n";
  cout << "\n";
  cout << "\n";
  cout << "\n";
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long int n, l;
  cin >> n >> l;
  vector<pair<long long int, long long int> > vp(n);
  for (int i = 0; i < n; i++) {
    cin >> vp[i].first >> vp[i].second;
  }
  for (int i = 0; i < n; i++) {
    if (vp[i].first == vp[i].second) {
      if (vp[i].first <= l) {
        dp[vp[i].first][i][vp[i].first]++;
      }
    } else {
      if (vp[i].first <= l) dp[vp[i].first][i][vp[i].second]++;
      if (vp[i].second <= l) dp[vp[i].second][i][vp[i].first]++;
    }
  }
  for (int i = 2; i <= l; i++) {
    for (int j = 0; j < n; j++) {
      for (int k = 0; k < n; k++) {
        if (k == j) continue;
        if (vp[j].first == vp[j].second) {
          if (i > (vp[j].first))
            dp[i][j][vp[j].second] =
                (dp[i][j][vp[j].second] + dp[i - vp[j].first][k][vp[j].first]) %
                1000000007;
        } else {
          if (i > (vp[j].first)) {
            dp[i][j][vp[j].second] =
                (dp[i][j][vp[j].second] + dp[i - vp[j].first][k][vp[j].first]) %
                1000000007;
          }
          if (i > (vp[j].second)) {
            dp[i][j][vp[j].first] = (dp[i][j][vp[j].first] +
                                     dp[i - vp[j].second][k][vp[j].second]) %
                                    1000000007;
          }
        }
      }
    }
  }
  long long int total = 0;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 101; j++) {
      total = (total + dp[l][i][j]) % 1000000007;
    }
  }
  cout << total;
  return 0;
}
