#include <bits/stdc++.h>
using namespace std;
long long dp[3011][111][2], a[110], b[110], n, l, ans = 0;
long long base = 1e9 + 7;
int main() {
  cin >> n >> l;
  for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
  for (int i = 0; i < n; i++) {
    dp[a[i]][i][0] = 1;
    if (a[i] != b[i]) dp[b[i]][i][1] = 1;
  }
  for (int i = 0; i < l; i++)
    for (int j = 0; j < n; j++)
      for (int k = 0; k < 2; k++)
        if (dp[i][j][k]) {
          int x = a[j];
          int y = b[j];
          if (k == 1) swap(x, y);
          if (x == y && k == 1) continue;
          for (int _j = 0; _j < n; _j++)
            if (j != _j)
              for (int _k = 0; _k < 2; _k++) {
                int _x = a[_j];
                int _y = b[_j];
                if (_k) swap(_x, _y);
                if (_x == _y && _k == 1) continue;
                if (_x == y && _x + i <= l)
                  dp[_x + i][_j][_k] += dp[i][j][k], dp[_x + i][_j][_k] %= base;
              }
        }
  for (int i = 0; i < n; i++) ans += (dp[l][i][0] + dp[l][i][1]), ans %= base;
  cout << ans << endl;
  return 0;
}
