#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int nax = 101;
const int len = 3010;
int a[nax], b[nax];
const ll mod = 1e9 + 7;
ll dp[len][len][3];
int main() {
  int n, l;
  cin >> n >> l;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }
  for (int i = 0; i < n; i++) {
    if (b[i] != a[i]) {
      dp[a[i]][i][0]++;
      dp[b[i]][i][1]++;
    } else
      dp[a[i]][i][2]++;
  }
  for (int i = 1; i <= l; i++) {
    for (int j = 0; j < n; j++) {
      for (int k = 0; k < n; k++) {
        if (j == k) continue;
        if (a[j] == b[j] && a[k] != b[k]) {
          if (i >= a[j] && a[j] == b[k]) dp[i][j][2] += dp[i - a[j]][k][0];
          dp[i][j][2] = dp[i][j][2] % mod;
          if (i >= b[j] && b[j] == a[k]) dp[i][j][2] += dp[i - b[j]][k][1];
          dp[i][j][2] = dp[i][j][2] % mod;
          continue;
        }
        if (a[j] == b[j] && a[k] == b[k]) {
          if (i >= a[j] && a[j] == a[k]) dp[i][j][2] += dp[i - a[j]][k][2];
          dp[i][j][2] = dp[i][j][2] % mod;
          continue;
        }
        if (a[k] == b[k]) {
          if (i >= a[j] && a[j] == a[k]) dp[i][j][0] += dp[i - a[j]][k][2];
          dp[i][j][0] = dp[i][j][0] % mod;
          if (i >= b[j] && b[j] == a[k]) dp[i][j][1] += dp[i - b[j]][k][2];
          dp[i][j][1] = dp[i][j][1] % mod;
          continue;
        }
        if (i >= a[j] && a[j] == b[k]) dp[i][j][0] += dp[i - a[j]][k][0];
        dp[i][j][0] = dp[i][j][0] % mod;
        if (i >= a[j] && a[j] == a[k]) dp[i][j][0] += dp[i - a[j]][k][1];
        dp[i][j][0] = dp[i][j][0] % mod;
        if (i >= b[j] && b[j] == b[k]) dp[i][j][1] += dp[i - b[j]][k][0];
        dp[i][j][1] = dp[i][j][1] % mod;
        if (i >= b[j] && b[j] == a[k]) dp[i][j][1] += dp[i - b[j]][k][1];
        dp[i][j][1] = dp[i][j][1] % mod;
      }
    }
  }
  ll ans = 0;
  for (int i = 0; i < n; i++) {
    ans += dp[l][i][0];
    ans %= mod;
    ans += dp[l][i][1];
    ans %= mod;
    ans += dp[l][i][2];
    ans %= mod;
  }
  cout << ans << endl;
  return 0;
}
